mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
parent
66f28ae02b
commit
00b827d5cf
@ -85,6 +85,9 @@ AC_DEFINE_UNQUOTED([ICINGA_LOCALSTATEDIR], "$ICINGA_LOCALSTATEDIR", [The local s
|
||||
AS_AC_EXPAND([ICINGA_PKGLIBDIR], $libdir/$PACKAGE)
|
||||
AC_DEFINE_UNQUOTED([ICINGA_PKGLIBDIR], "$ICINGA_PKGLIBDIR", [The package lib dir.])
|
||||
|
||||
AS_AC_EXPAND([ICINGA_PKGDATADIR], $datadir/$PACKAGE)
|
||||
AC_DEFINE_UNQUOTED([ICINGA_PKGDATADIR], "$ICINGA_PKGDATADIR", [The package data dir.])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
components/Makefile
|
||||
|
@ -65,6 +65,10 @@ int main(int argc, char **argv)
|
||||
Application::SetPkgLibDir(ICINGA_PKGLIBDIR);
|
||||
#endif /* ICINGA_PKGLIBDIR */
|
||||
|
||||
#ifdef ICINGA_PKGDATADIR
|
||||
Application::SetPkgDataDir(ICINGA_PKGDATADIR);
|
||||
#endif /* ICINGA_PKGDATADIR */
|
||||
|
||||
Logger::Write(LogInformation, "icinga", "Icinga application loader"
|
||||
#ifndef _WIN32
|
||||
" (version: " ICINGA_VERSION ")"
|
||||
@ -82,6 +86,8 @@ int main(int argc, char **argv)
|
||||
|
||||
Utility::LoadIcingaLibrary("icinga", false);
|
||||
|
||||
ConfigCompiler::AddIncludeSearchDir(Application::GetPkgDataDir());
|
||||
|
||||
try {
|
||||
DynamicObject::BeginTx();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
icinga2itldir = ${datarootdir}/icinga2/itl
|
||||
icinga2itldir = ${pkgdatadir}/itl
|
||||
icinga2itl_DATA = \
|
||||
itl.conf \
|
||||
itl-host.conf \
|
||||
|
@ -28,6 +28,7 @@ boost::thread::id Application::m_MainThreadID;
|
||||
String Application::m_PrefixDir;
|
||||
String Application::m_LocalStateDir;
|
||||
String Application::m_PkgLibDir;
|
||||
String Application::m_PkgDataDir;
|
||||
|
||||
/**
|
||||
* Constructor for the Application class.
|
||||
@ -112,8 +113,7 @@ void Application::RunEventLoop(void)
|
||||
|
||||
Event::ProcessEvents(boost::posix_time::milliseconds(sleep * 1000));
|
||||
|
||||
DynamicObject::FinishTx();
|
||||
DynamicObject::BeginTx();
|
||||
DynamicObject::FlushTx();
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (nextProfile < Utility::GetTime()) {
|
||||
@ -522,7 +522,7 @@ void Application::SetLocalStateDir(const String& path)
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrives the path for the package lib dir.
|
||||
* Retrieves the path for the package lib dir.
|
||||
*
|
||||
* @returns The path.
|
||||
*/
|
||||
@ -543,3 +543,27 @@ void Application::SetPkgLibDir(const String& path)
|
||||
{
|
||||
m_PkgLibDir = path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the path for the package data dir.
|
||||
*
|
||||
* @returns The path.
|
||||
*/
|
||||
String Application::GetPkgDataDir(void)
|
||||
{
|
||||
if (m_PkgDataDir.IsEmpty())
|
||||
return ".";
|
||||
else
|
||||
return m_PkgDataDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the path for the package data dir.
|
||||
*
|
||||
* @param path The new path.
|
||||
*/
|
||||
void Application::SetPkgDataDir(const String& path)
|
||||
{
|
||||
m_PkgDataDir = path;
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,9 @@ public:
|
||||
static String GetPkgLibDir(void);
|
||||
static void SetPkgLibDir(const String& path);
|
||||
|
||||
static String GetPkgDataDir(void);
|
||||
static void SetPkgDataDir(const String& path);
|
||||
|
||||
protected:
|
||||
void RunEventLoop(void);
|
||||
|
||||
@ -88,6 +91,7 @@ private:
|
||||
static String m_PrefixDir; /**< The installation prefix. */
|
||||
static String m_LocalStateDir; /**< The local state dir. */
|
||||
static String m_PkgLibDir; /**< The package lib dir. */
|
||||
static String m_PkgDataDir; /**< The package data dir. */
|
||||
|
||||
#ifndef _WIN32
|
||||
static void SigIntHandler(int signum);
|
||||
|
@ -370,8 +370,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
|
||||
*yy_cp = '\0'; \
|
||||
yyg->yy_c_buf_p = yy_cp;
|
||||
|
||||
#define YY_NUM_RULES 28
|
||||
#define YY_END_OF_BUFFER 29
|
||||
#define YY_NUM_RULES 29
|
||||
#define YY_END_OF_BUFFER 30
|
||||
/* This struct is not used in this scanner,
|
||||
but its presence is necessary. */
|
||||
struct yy_trans_info
|
||||
@ -379,18 +379,18 @@ struct yy_trans_info
|
||||
flex_int32_t yy_verify;
|
||||
flex_int32_t yy_nxt;
|
||||
};
|
||||
static yyconst flex_int16_t yy_accept[94] =
|
||||
static yyconst flex_int16_t yy_accept[97] =
|
||||
{ 0,
|
||||
0, 0, 0, 0, 29, 27, 26, 26, 27, 27,
|
||||
27, 27, 27, 27, 15, 16, 10, 10, 10, 10,
|
||||
10, 10, 10, 10, 23, 24, 26, 0, 11, 0,
|
||||
0, 19, 17, 15, 18, 21, 0, 20, 0, 12,
|
||||
13, 14, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
23, 22, 0, 0, 25, 15, 10, 10, 10, 10,
|
||||
10, 10, 10, 0, 0, 10, 10, 10, 10, 7,
|
||||
10, 8, 0, 0, 10, 9, 10, 2, 10, 0,
|
||||
0, 10, 10, 3, 0, 0, 10, 10, 4, 5,
|
||||
1, 6, 0
|
||||
0, 0, 0, 0, 30, 28, 27, 27, 28, 28,
|
||||
28, 28, 28, 28, 16, 28, 17, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 24, 25, 27, 0, 11,
|
||||
0, 0, 20, 18, 16, 19, 22, 0, 21, 0,
|
||||
13, 14, 15, 0, 12, 10, 10, 10, 10, 10,
|
||||
10, 10, 10, 24, 23, 0, 0, 26, 16, 10,
|
||||
10, 10, 10, 10, 10, 10, 0, 0, 10, 10,
|
||||
10, 10, 7, 10, 8, 0, 0, 10, 9, 10,
|
||||
2, 10, 0, 0, 10, 10, 3, 0, 0, 10,
|
||||
10, 4, 5, 1, 6, 0
|
||||
|
||||
} ;
|
||||
|
||||
@ -401,15 +401,15 @@ static yyconst flex_int32_t yy_ec[256] =
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
|
||||
1, 6, 7, 1, 8, 9, 10, 11, 11, 11,
|
||||
11, 11, 11, 11, 11, 11, 11, 1, 1, 1,
|
||||
12, 1, 1, 1, 13, 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
|
||||
1, 1, 1, 1, 13, 1, 14, 15, 16, 17,
|
||||
11, 11, 11, 11, 11, 11, 11, 1, 1, 12,
|
||||
13, 14, 1, 1, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||
1, 1, 1, 1, 15, 1, 16, 17, 18, 19,
|
||||
|
||||
18, 19, 13, 20, 21, 22, 13, 23, 24, 25,
|
||||
26, 13, 13, 27, 28, 29, 30, 13, 13, 13,
|
||||
31, 13, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
20, 21, 15, 22, 23, 24, 15, 25, 26, 27,
|
||||
28, 15, 15, 29, 30, 31, 32, 15, 15, 15,
|
||||
33, 15, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
@ -426,91 +426,95 @@ static yyconst flex_int32_t yy_ec[256] =
|
||||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_meta[32] =
|
||||
static yyconst flex_int32_t yy_meta[34] =
|
||||
{ 0,
|
||||
1, 1, 2, 1, 1, 3, 1, 4, 1, 1,
|
||||
4, 1, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 1, 1, 1, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4
|
||||
4, 4, 4
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_base[99] =
|
||||
static yyconst flex_int16_t yy_base[103] =
|
||||
{ 0,
|
||||
0, 0, 116, 115, 120, 123, 30, 32, 115, 15,
|
||||
106, 105, 28, 31, 35, 123, 0, 101, 101, 89,
|
||||
87, 82, 96, 83, 0, 99, 45, 104, 123, 82,
|
||||
85, 123, 123, 0, 123, 123, 0, 123, 94, 123,
|
||||
123, 123, 0, 76, 80, 82, 85, 77, 77, 68,
|
||||
0, 123, 81, 81, 0, 34, 66, 66, 75, 78,
|
||||
68, 72, 71, 65, 60, 59, 67, 57, 60, 0,
|
||||
66, 0, 51, 66, 63, 0, 53, 0, 32, 43,
|
||||
30, 40, 24, 0, 34, 20, 21, 21, 123, 123,
|
||||
0, 0, 123, 63, 67, 38, 71, 75
|
||||
0, 0, 124, 123, 128, 131, 32, 34, 123, 15,
|
||||
113, 112, 28, 36, 41, 110, 131, 0, 106, 106,
|
||||
94, 92, 87, 101, 88, 0, 106, 41, 111, 131,
|
||||
87, 90, 131, 131, 0, 131, 131, 0, 131, 101,
|
||||
131, 131, 131, 97, 131, 0, 80, 84, 86, 89,
|
||||
81, 81, 72, 0, 131, 85, 85, 0, 34, 70,
|
||||
70, 79, 82, 72, 76, 75, 69, 64, 63, 69,
|
||||
57, 45, 0, 51, 0, 36, 50, 49, 0, 39,
|
||||
0, 30, 40, 29, 39, 24, 0, 34, 20, 20,
|
||||
18, 131, 131, 0, 0, 131, 71, 75, 79, 43,
|
||||
|
||||
83, 87
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_def[99] =
|
||||
static yyconst flex_int16_t yy_def[103] =
|
||||
{ 0,
|
||||
93, 1, 94, 94, 93, 93, 93, 93, 95, 93,
|
||||
93, 93, 93, 93, 93, 93, 96, 96, 96, 96,
|
||||
96, 96, 96, 96, 97, 93, 93, 95, 93, 93,
|
||||
93, 93, 93, 15, 93, 93, 98, 93, 93, 93,
|
||||
93, 93, 96, 96, 96, 96, 96, 96, 96, 96,
|
||||
97, 93, 93, 93, 98, 93, 96, 96, 96, 96,
|
||||
96, 96, 96, 93, 93, 96, 96, 96, 96, 96,
|
||||
96, 96, 93, 93, 96, 96, 96, 96, 96, 93,
|
||||
93, 96, 96, 96, 93, 93, 96, 96, 93, 93,
|
||||
96, 96, 0, 93, 93, 93, 93, 93
|
||||
96, 1, 97, 97, 96, 96, 96, 96, 98, 96,
|
||||
96, 96, 96, 96, 96, 99, 96, 100, 100, 100,
|
||||
100, 100, 100, 100, 100, 101, 96, 96, 98, 96,
|
||||
96, 96, 96, 96, 15, 96, 96, 102, 96, 96,
|
||||
96, 96, 96, 99, 96, 100, 100, 100, 100, 100,
|
||||
100, 100, 100, 101, 96, 96, 96, 102, 96, 100,
|
||||
100, 100, 100, 100, 100, 100, 96, 96, 100, 100,
|
||||
100, 100, 100, 100, 100, 96, 96, 100, 100, 100,
|
||||
100, 100, 96, 96, 100, 100, 100, 96, 96, 100,
|
||||
100, 96, 96, 100, 100, 0, 96, 96, 96, 96,
|
||||
|
||||
96, 96
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_nxt[155] =
|
||||
static yyconst flex_int16_t yy_nxt[165] =
|
||||
{ 0,
|
||||
6, 7, 8, 9, 10, 11, 12, 13, 6, 14,
|
||||
15, 16, 17, 18, 17, 17, 17, 17, 19, 17,
|
||||
20, 17, 21, 17, 22, 23, 17, 17, 24, 17,
|
||||
17, 27, 27, 27, 27, 30, 36, 31, 34, 35,
|
||||
37, 43, 38, 39, 56, 34, 27, 27, 92, 91,
|
||||
90, 89, 88, 40, 40, 87, 86, 41, 41, 85,
|
||||
84, 42, 42, 25, 25, 25, 25, 28, 28, 28,
|
||||
28, 51, 51, 83, 51, 55, 82, 55, 55, 81,
|
||||
80, 79, 78, 77, 76, 75, 74, 73, 72, 71,
|
||||
70, 69, 68, 67, 66, 65, 64, 63, 62, 61,
|
||||
15, 16, 17, 6, 18, 19, 18, 18, 18, 18,
|
||||
20, 18, 21, 18, 22, 18, 23, 24, 18, 18,
|
||||
25, 18, 18, 28, 28, 28, 28, 31, 35, 32,
|
||||
36, 37, 28, 28, 59, 38, 46, 95, 39, 40,
|
||||
94, 35, 93, 92, 91, 41, 90, 89, 88, 42,
|
||||
87, 86, 41, 43, 85, 84, 42, 83, 82, 81,
|
||||
43, 26, 26, 26, 26, 29, 29, 29, 29, 44,
|
||||
44, 44, 44, 54, 54, 80, 54, 58, 79, 58,
|
||||
58, 78, 77, 76, 75, 74, 73, 72, 71, 70,
|
||||
|
||||
60, 59, 58, 57, 56, 54, 53, 29, 52, 50,
|
||||
49, 48, 47, 46, 45, 44, 33, 32, 29, 93,
|
||||
26, 26, 5, 93, 93, 93, 93, 93, 93, 93,
|
||||
93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
|
||||
93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
|
||||
93, 93, 93, 93
|
||||
69, 68, 67, 66, 65, 64, 63, 62, 61, 60,
|
||||
45, 59, 57, 56, 30, 55, 53, 52, 51, 50,
|
||||
49, 48, 47, 45, 34, 33, 30, 96, 27, 27,
|
||||
5, 96, 96, 96, 96, 96, 96, 96, 96, 96,
|
||||
96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
|
||||
96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
|
||||
96, 96, 96, 96
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_chk[155] =
|
||||
static yyconst flex_int16_t yy_chk[165] =
|
||||
{ 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 7, 7, 8, 8, 10, 14, 10, 13, 13,
|
||||
14, 96, 14, 15, 56, 15, 27, 27, 88, 87,
|
||||
86, 85, 83, 56, 15, 82, 81, 56, 15, 80,
|
||||
79, 56, 15, 94, 94, 94, 94, 95, 95, 95,
|
||||
95, 97, 97, 77, 97, 98, 75, 98, 98, 74,
|
||||
73, 71, 69, 68, 67, 66, 65, 64, 63, 62,
|
||||
61, 60, 59, 58, 57, 54, 53, 50, 49, 48,
|
||||
1, 1, 1, 7, 7, 8, 8, 10, 13, 10,
|
||||
13, 14, 28, 28, 59, 14, 100, 91, 14, 15,
|
||||
90, 15, 89, 88, 86, 59, 85, 84, 83, 59,
|
||||
82, 80, 15, 59, 78, 77, 15, 76, 74, 72,
|
||||
15, 97, 97, 97, 97, 98, 98, 98, 98, 99,
|
||||
99, 99, 99, 101, 101, 71, 101, 102, 70, 102,
|
||||
102, 69, 68, 67, 66, 65, 64, 63, 62, 61,
|
||||
|
||||
47, 46, 45, 44, 39, 31, 30, 28, 26, 24,
|
||||
23, 22, 21, 20, 19, 18, 12, 11, 9, 5,
|
||||
4, 3, 93, 93, 93, 93, 93, 93, 93, 93,
|
||||
93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
|
||||
93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
|
||||
93, 93, 93, 93
|
||||
60, 57, 56, 53, 52, 51, 50, 49, 48, 47,
|
||||
44, 40, 32, 31, 29, 27, 25, 24, 23, 22,
|
||||
21, 20, 19, 16, 12, 11, 9, 5, 4, 3,
|
||||
96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
|
||||
96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
|
||||
96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
|
||||
96, 96, 96, 96
|
||||
} ;
|
||||
|
||||
/* Table of booleans, true if rule could match eol. */
|
||||
static yyconst flex_int32_t yy_rule_can_match_eol[29] =
|
||||
static yyconst flex_int32_t yy_rule_can_match_eol[30] =
|
||||
{ 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 1, 0, 0, };
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 0, 0, 1, 0, 0, };
|
||||
|
||||
/* The intent behind this definition is that it'll catch
|
||||
* any uses of REJECT which flex missed.
|
||||
@ -562,7 +566,7 @@ do { \
|
||||
} while (0)
|
||||
#define YY_NO_UNISTD_H 1
|
||||
|
||||
#line 566 "config_lexer.cc"
|
||||
#line 570 "config_lexer.cc"
|
||||
|
||||
#define INITIAL 0
|
||||
#define IN_C_COMMENT 1
|
||||
@ -811,7 +815,7 @@ YY_DECL
|
||||
|
||||
#line 49 "config_lexer.ll"
|
||||
|
||||
#line 815 "config_lexer.cc"
|
||||
#line 819 "config_lexer.cc"
|
||||
|
||||
yylval = yylval_param;
|
||||
|
||||
@ -868,13 +872,13 @@ yy_match:
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 94 )
|
||||
if ( yy_current_state >= 97 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
++yy_cp;
|
||||
}
|
||||
while ( yy_current_state != 93 );
|
||||
while ( yy_current_state != 96 );
|
||||
yy_cp = yyg->yy_last_accepting_cpos;
|
||||
yy_current_state = yyg->yy_last_accepting_state;
|
||||
|
||||
@ -963,19 +967,20 @@ YY_RULE_SETUP
|
||||
{ yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING; }
|
||||
YY_BREAK
|
||||
case 12:
|
||||
/* rule 12 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 61 "config_lexer.ll"
|
||||
{ yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; }
|
||||
{ yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING_ANGLE; }
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 62 "config_lexer.ll"
|
||||
{ yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; }
|
||||
{ yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; }
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 63 "config_lexer.ll"
|
||||
{ yylval->num = strtod(yytext, NULL); return T_NUMBER; }
|
||||
{ yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; }
|
||||
YY_BREAK
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
@ -985,75 +990,80 @@ YY_RULE_SETUP
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 65 "config_lexer.ll"
|
||||
{ yylval->op = OperatorSet; return T_EQUAL; }
|
||||
{ yylval->num = strtod(yytext, NULL); return T_NUMBER; }
|
||||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 66 "config_lexer.ll"
|
||||
{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
|
||||
{ yylval->op = OperatorSet; return T_EQUAL; }
|
||||
YY_BREAK
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 67 "config_lexer.ll"
|
||||
{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
|
||||
{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
|
||||
YY_BREAK
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 68 "config_lexer.ll"
|
||||
{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
|
||||
{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
|
||||
YY_BREAK
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 69 "config_lexer.ll"
|
||||
{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
|
||||
YY_BREAK
|
||||
case 21:
|
||||
YY_RULE_SETUP
|
||||
#line 70 "config_lexer.ll"
|
||||
{ yylval->op = OperatorDivide; return T_DIVIDE_EQUAL; }
|
||||
YY_BREAK
|
||||
|
||||
case 21:
|
||||
case 22:
|
||||
YY_RULE_SETUP
|
||||
#line 72 "config_lexer.ll"
|
||||
#line 73 "config_lexer.ll"
|
||||
BEGIN(IN_C_COMMENT);
|
||||
YY_BREAK
|
||||
|
||||
|
||||
case 22:
|
||||
YY_RULE_SETUP
|
||||
#line 76 "config_lexer.ll"
|
||||
BEGIN(INITIAL);
|
||||
YY_BREAK
|
||||
case 23:
|
||||
/* rule 23 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 77 "config_lexer.ll"
|
||||
/* ignore comment */
|
||||
BEGIN(INITIAL);
|
||||
YY_BREAK
|
||||
case 24:
|
||||
/* rule 24 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 78 "config_lexer.ll"
|
||||
/* ignore comment */
|
||||
YY_BREAK
|
||||
case 25:
|
||||
YY_RULE_SETUP
|
||||
#line 79 "config_lexer.ll"
|
||||
/* ignore star */
|
||||
YY_BREAK
|
||||
|
||||
case 25:
|
||||
YY_RULE_SETUP
|
||||
#line 81 "config_lexer.ll"
|
||||
/* ignore C++-style comments */
|
||||
YY_BREAK
|
||||
case 26:
|
||||
/* rule 26 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 82 "config_lexer.ll"
|
||||
/* ignore whitespace */
|
||||
/* ignore C++-style comments */
|
||||
YY_BREAK
|
||||
case 27:
|
||||
/* rule 27 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 84 "config_lexer.ll"
|
||||
return yytext[0];
|
||||
#line 83 "config_lexer.ll"
|
||||
/* ignore whitespace */
|
||||
YY_BREAK
|
||||
case 28:
|
||||
YY_RULE_SETUP
|
||||
#line 85 "config_lexer.ll"
|
||||
return yytext[0];
|
||||
YY_BREAK
|
||||
case 29:
|
||||
YY_RULE_SETUP
|
||||
#line 86 "config_lexer.ll"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1057 "config_lexer.cc"
|
||||
#line 1067 "config_lexer.cc"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(IN_C_COMMENT):
|
||||
yyterminate();
|
||||
@ -1349,7 +1359,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 94 )
|
||||
if ( yy_current_state >= 97 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
@ -1378,11 +1388,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 94 )
|
||||
if ( yy_current_state >= 97 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 93);
|
||||
yy_is_jam = (yy_current_state == 96);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
@ -2241,7 +2251,7 @@ void yyfree (void * ptr , yyscan_t yyscanner)
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 85 "config_lexer.ll"
|
||||
#line 86 "config_lexer.ll"
|
||||
|
||||
|
||||
|
||||
|
@ -58,6 +58,7 @@ true { yylval->num = 1; return T_NUMBER; }
|
||||
false { yylval->num = 0; return T_NUMBER; }
|
||||
[a-zA-Z_][a-zA-Z0-9\-_]* { yylval->text = strdup(yytext); return T_IDENTIFIER; }
|
||||
\"[^\"]*\" { yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING; }
|
||||
\<[^\>]*\> { yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING_ANGLE; }
|
||||
-?[0-9]+(\.[0-9]+)?h { yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; }
|
||||
-?[0-9]+(\.[0-9]+)?m { yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; }
|
||||
-?[0-9]+(\.[0-9]+)?s { yylval->num = strtod(yytext, NULL); return T_NUMBER; }
|
||||
|
@ -130,38 +130,40 @@ using namespace icinga;
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
T_STRING = 258,
|
||||
T_NUMBER = 259,
|
||||
T_NULL = 260,
|
||||
T_IDENTIFIER = 261,
|
||||
T_EQUAL = 262,
|
||||
T_PLUS_EQUAL = 263,
|
||||
T_MINUS_EQUAL = 264,
|
||||
T_MULTIPLY_EQUAL = 265,
|
||||
T_DIVIDE_EQUAL = 266,
|
||||
T_ABSTRACT = 267,
|
||||
T_LOCAL = 268,
|
||||
T_OBJECT = 269,
|
||||
T_INCLUDE = 270,
|
||||
T_LIBRARY = 271,
|
||||
T_INHERITS = 272
|
||||
T_STRING_ANGLE = 259,
|
||||
T_NUMBER = 260,
|
||||
T_NULL = 261,
|
||||
T_IDENTIFIER = 262,
|
||||
T_EQUAL = 263,
|
||||
T_PLUS_EQUAL = 264,
|
||||
T_MINUS_EQUAL = 265,
|
||||
T_MULTIPLY_EQUAL = 266,
|
||||
T_DIVIDE_EQUAL = 267,
|
||||
T_ABSTRACT = 268,
|
||||
T_LOCAL = 269,
|
||||
T_OBJECT = 270,
|
||||
T_INCLUDE = 271,
|
||||
T_LIBRARY = 272,
|
||||
T_INHERITS = 273
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define T_STRING 258
|
||||
#define T_NUMBER 259
|
||||
#define T_NULL 260
|
||||
#define T_IDENTIFIER 261
|
||||
#define T_EQUAL 262
|
||||
#define T_PLUS_EQUAL 263
|
||||
#define T_MINUS_EQUAL 264
|
||||
#define T_MULTIPLY_EQUAL 265
|
||||
#define T_DIVIDE_EQUAL 266
|
||||
#define T_ABSTRACT 267
|
||||
#define T_LOCAL 268
|
||||
#define T_OBJECT 269
|
||||
#define T_INCLUDE 270
|
||||
#define T_LIBRARY 271
|
||||
#define T_INHERITS 272
|
||||
#define T_STRING_ANGLE 259
|
||||
#define T_NUMBER 260
|
||||
#define T_NULL 261
|
||||
#define T_IDENTIFIER 262
|
||||
#define T_EQUAL 263
|
||||
#define T_PLUS_EQUAL 264
|
||||
#define T_MINUS_EQUAL 265
|
||||
#define T_MULTIPLY_EQUAL 266
|
||||
#define T_DIVIDE_EQUAL 267
|
||||
#define T_ABSTRACT 268
|
||||
#define T_LOCAL 269
|
||||
#define T_OBJECT 270
|
||||
#define T_INCLUDE 271
|
||||
#define T_LIBRARY 272
|
||||
#define T_INHERITS 273
|
||||
|
||||
|
||||
|
||||
@ -181,7 +183,7 @@ typedef union YYSTYPE
|
||||
|
||||
|
||||
/* Line 293 of yacc.c */
|
||||
#line 185 "config_parser.cc"
|
||||
#line 187 "config_parser.cc"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
@ -205,7 +207,7 @@ typedef struct YYLTYPE
|
||||
/* Copy the second part of user declarations. */
|
||||
|
||||
/* Line 343 of yacc.c */
|
||||
#line 67 "config_parser.yy"
|
||||
#line 68 "config_parser.yy"
|
||||
|
||||
|
||||
int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner);
|
||||
@ -235,7 +237,7 @@ void ConfigCompiler::Compile(void)
|
||||
|
||||
|
||||
/* Line 343 of yacc.c */
|
||||
#line 239 "config_parser.cc"
|
||||
#line 241 "config_parser.cc"
|
||||
|
||||
#ifdef short
|
||||
# undef short
|
||||
@ -456,20 +458,20 @@ union yyalloc
|
||||
/* YYFINAL -- State number of the termination state. */
|
||||
#define YYFINAL 2
|
||||
/* YYLAST -- Last index in YYTABLE. */
|
||||
#define YYLAST 47
|
||||
#define YYLAST 44
|
||||
|
||||
/* YYNTOKENS -- Number of terminals. */
|
||||
#define YYNTOKENS 27
|
||||
#define YYNTOKENS 28
|
||||
/* YYNNTS -- Number of nonterminals. */
|
||||
#define YYNNTS 22
|
||||
/* YYNRULES -- Number of rules. */
|
||||
#define YYNRULES 42
|
||||
#define YYNRULES 43
|
||||
/* YYNRULES -- Number of states. */
|
||||
#define YYNSTATES 57
|
||||
#define YYNSTATES 58
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
#define YYUNDEFTOK 2
|
||||
#define YYMAXUTOK 272
|
||||
#define YYMAXUTOK 273
|
||||
|
||||
#define YYTRANSLATE(YYX) \
|
||||
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
@ -481,15 +483,15 @@ static const yytype_uint8 yytranslate[] =
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 20, 18, 22, 19, 2, 21, 2, 2,
|
||||
2, 2, 21, 19, 23, 20, 2, 22, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 25, 2, 26, 2, 2, 2, 2, 2, 2,
|
||||
2, 26, 2, 27, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 23, 2, 24, 2, 2, 2, 2,
|
||||
2, 2, 2, 24, 2, 25, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
@ -504,7 +506,7 @@ static const yytype_uint8 yytranslate[] =
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
15, 16, 17
|
||||
15, 16, 17, 18
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
@ -513,36 +515,36 @@ static const yytype_uint8 yytranslate[] =
|
||||
static const yytype_uint8 yyprhs[] =
|
||||
{
|
||||
0, 0, 3, 4, 7, 9, 11, 13, 16, 19,
|
||||
21, 23, 24, 25, 34, 35, 38, 40, 42, 44,
|
||||
48, 50, 51, 54, 55, 60, 62, 65, 66, 68,
|
||||
72, 76, 83, 85, 87, 89, 91, 93, 95, 97,
|
||||
99, 101, 103
|
||||
22, 24, 26, 27, 28, 37, 38, 41, 43, 45,
|
||||
47, 51, 53, 54, 57, 58, 63, 65, 68, 69,
|
||||
71, 75, 79, 86, 88, 90, 92, 94, 96, 98,
|
||||
100, 102, 104, 106
|
||||
};
|
||||
|
||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||
static const yytype_int8 yyrhs[] =
|
||||
{
|
||||
28, 0, -1, -1, 28, 29, -1, 33, -1, 30,
|
||||
-1, 31, -1, 15, 3, -1, 16, 3, -1, 6,
|
||||
-1, 3, -1, -1, -1, 34, 36, 14, 32, 3,
|
||||
35, 40, 41, -1, -1, 36, 37, -1, 12, -1,
|
||||
13, -1, 39, -1, 38, 22, 39, -1, 3, -1,
|
||||
-1, 17, 38, -1, -1, 23, 42, 43, 24, -1,
|
||||
44, -1, 44, 22, -1, -1, 45, -1, 44, 22,
|
||||
45, -1, 32, 46, 48, -1, 32, 25, 3, 26,
|
||||
46, 48, -1, 3, -1, 7, -1, 8, -1, 9,
|
||||
-1, 10, -1, 11, -1, 3, -1, 4, -1, 5,
|
||||
-1, 47, -1, 41, -1
|
||||
29, 0, -1, -1, 29, 30, -1, 34, -1, 31,
|
||||
-1, 32, -1, 16, 3, -1, 16, 4, -1, 17,
|
||||
3, -1, 7, -1, 3, -1, -1, -1, 35, 37,
|
||||
15, 33, 3, 36, 41, 42, -1, -1, 37, 38,
|
||||
-1, 13, -1, 14, -1, 40, -1, 39, 23, 40,
|
||||
-1, 3, -1, -1, 18, 39, -1, -1, 24, 43,
|
||||
44, 25, -1, 45, -1, 45, 23, -1, -1, 46,
|
||||
-1, 45, 23, 46, -1, 33, 47, 49, -1, 33,
|
||||
26, 3, 27, 47, 49, -1, 3, -1, 8, -1,
|
||||
9, -1, 10, -1, 11, -1, 12, -1, 3, -1,
|
||||
5, -1, 6, -1, 48, -1, 42, -1
|
||||
};
|
||||
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const yytype_uint8 yyrline[] =
|
||||
static const yytype_uint16 yyrline[] =
|
||||
{
|
||||
0, 96, 96, 97, 100, 100, 100, 103, 108, 113,
|
||||
114, 121, 126, 121, 145, 146, 149, 153, 159, 160,
|
||||
163, 170, 171, 175, 174, 186, 187, 189, 190, 191,
|
||||
194, 202, 216, 225, 226, 227, 228, 229, 235, 240,
|
||||
244, 250, 251
|
||||
0, 97, 97, 98, 101, 101, 101, 104, 108, 113,
|
||||
118, 119, 126, 131, 126, 150, 151, 154, 158, 164,
|
||||
165, 168, 175, 176, 180, 179, 191, 192, 194, 195,
|
||||
196, 199, 207, 221, 230, 231, 232, 233, 234, 240,
|
||||
245, 249, 255, 256
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -551,8 +553,8 @@ static const yytype_uint8 yyrline[] =
|
||||
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
||||
static const char *const yytname[] =
|
||||
{
|
||||
"$end", "error", "$undefined", "T_STRING", "T_NUMBER", "T_NULL",
|
||||
"T_IDENTIFIER", "T_EQUAL", "T_PLUS_EQUAL", "T_MINUS_EQUAL",
|
||||
"$end", "error", "$undefined", "T_STRING", "T_STRING_ANGLE", "T_NUMBER",
|
||||
"T_NULL", "T_IDENTIFIER", "T_EQUAL", "T_PLUS_EQUAL", "T_MINUS_EQUAL",
|
||||
"T_MULTIPLY_EQUAL", "T_DIVIDE_EQUAL", "T_ABSTRACT", "T_LOCAL",
|
||||
"T_OBJECT", "T_INCLUDE", "T_LIBRARY", "T_INHERITS", "'+'", "'-'", "'*'",
|
||||
"'/'", "','", "'{'", "'}'", "'['", "']'", "$accept", "statements",
|
||||
@ -569,29 +571,29 @@ static const char *const yytname[] =
|
||||
static const yytype_uint16 yytoknum[] =
|
||||
{
|
||||
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
||||
265, 266, 267, 268, 269, 270, 271, 272, 43, 45,
|
||||
42, 47, 44, 123, 125, 91, 93
|
||||
265, 266, 267, 268, 269, 270, 271, 272, 273, 43,
|
||||
45, 42, 47, 44, 123, 125, 91, 93
|
||||
};
|
||||
# endif
|
||||
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const yytype_uint8 yyr1[] =
|
||||
{
|
||||
0, 27, 28, 28, 29, 29, 29, 30, 31, 32,
|
||||
32, 34, 35, 33, 36, 36, 37, 37, 38, 38,
|
||||
39, 40, 40, 42, 41, 43, 43, 44, 44, 44,
|
||||
45, 45, 45, 46, 46, 46, 46, 46, 47, 47,
|
||||
47, 48, 48
|
||||
0, 28, 29, 29, 30, 30, 30, 31, 31, 32,
|
||||
33, 33, 35, 36, 34, 37, 37, 38, 38, 39,
|
||||
39, 40, 41, 41, 43, 42, 44, 44, 45, 45,
|
||||
45, 46, 46, 46, 47, 47, 47, 47, 47, 48,
|
||||
48, 48, 49, 49
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
static const yytype_uint8 yyr2[] =
|
||||
{
|
||||
0, 2, 0, 2, 1, 1, 1, 2, 2, 1,
|
||||
1, 0, 0, 8, 0, 2, 1, 1, 1, 3,
|
||||
1, 0, 2, 0, 4, 1, 2, 0, 1, 3,
|
||||
3, 6, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1
|
||||
0, 2, 0, 2, 1, 1, 1, 2, 2, 2,
|
||||
1, 1, 0, 0, 8, 0, 2, 1, 1, 1,
|
||||
3, 1, 0, 2, 0, 4, 1, 2, 0, 1,
|
||||
3, 3, 6, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1
|
||||
};
|
||||
|
||||
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
|
||||
@ -599,81 +601,81 @@ static const yytype_uint8 yyr2[] =
|
||||
means the default is an error. */
|
||||
static const yytype_uint8 yydefact[] =
|
||||
{
|
||||
2, 11, 1, 0, 0, 3, 5, 6, 4, 14,
|
||||
7, 8, 0, 16, 17, 0, 15, 10, 9, 0,
|
||||
12, 21, 0, 0, 20, 22, 18, 23, 13, 0,
|
||||
27, 19, 10, 0, 0, 25, 28, 33, 34, 35,
|
||||
36, 37, 0, 0, 24, 26, 0, 38, 39, 40,
|
||||
42, 41, 30, 29, 0, 0, 31
|
||||
2, 12, 1, 0, 0, 3, 5, 6, 4, 15,
|
||||
7, 8, 9, 0, 17, 18, 0, 16, 11, 10,
|
||||
0, 13, 22, 0, 0, 21, 23, 19, 24, 14,
|
||||
0, 28, 20, 11, 0, 0, 26, 29, 34, 35,
|
||||
36, 37, 38, 0, 0, 25, 27, 0, 39, 40,
|
||||
41, 43, 42, 31, 30, 0, 0, 32
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yydefgoto[] =
|
||||
{
|
||||
-1, 1, 5, 6, 7, 33, 8, 9, 21, 12,
|
||||
16, 25, 26, 23, 50, 30, 34, 35, 36, 43,
|
||||
51, 52
|
||||
-1, 1, 5, 6, 7, 34, 8, 9, 22, 13,
|
||||
17, 26, 27, 24, 51, 31, 35, 36, 37, 44,
|
||||
52, 53
|
||||
};
|
||||
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
#define YYPACT_NINF -16
|
||||
#define YYPACT_NINF -15
|
||||
static const yytype_int8 yypact[] =
|
||||
{
|
||||
-16, 8, -16, 16, 19, -16, -16, -16, -16, -16,
|
||||
-16, -16, 13, -16, -16, 11, -16, -16, -16, 26,
|
||||
-16, -1, 28, 9, -16, 14, -16, -16, -16, 28,
|
||||
12, -16, 6, -4, 10, 15, -16, -16, -16, -16,
|
||||
-16, -16, 30, -3, -16, 12, 17, -16, -16, -16,
|
||||
-16, -16, -16, -16, 2, -3, -16
|
||||
-15, 1, -15, 26, 6, -15, -15, -15, -15, -15,
|
||||
-15, -15, -15, 10, -15, -15, 12, -15, -15, -15,
|
||||
24, -15, 14, 28, 9, -15, 11, -15, -15, -15,
|
||||
28, 13, -15, 3, -4, 15, 16, -15, -15, -15,
|
||||
-15, -15, -15, 32, -3, -15, 13, 17, -15, -15,
|
||||
-15, -15, -15, -15, -15, 2, -3, -15
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yypgoto[] =
|
||||
{
|
||||
-16, -16, -16, -16, -16, 20, -16, -16, -16, -16,
|
||||
-16, -16, 18, -16, 21, -16, -16, -16, -7, -15,
|
||||
-16, -14
|
||||
-15, -15, -15, -15, -15, 20, -15, -15, -15, -15,
|
||||
-15, -15, 7, -15, 18, -15, -15, -15, -8, -14,
|
||||
-15, -13
|
||||
};
|
||||
|
||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||
positive, shift that token. If negative, reduce the rule which
|
||||
number is the opposite. If YYTABLE_NINF, syntax error. */
|
||||
#define YYTABLE_NINF -33
|
||||
#define YYTABLE_NINF -34
|
||||
static const yytype_int8 yytable[] =
|
||||
{
|
||||
47, 48, 49, 37, 38, 39, 40, 41, 2, 37,
|
||||
38, 39, 40, 41, 17, 32, 22, 18, 18, 10,
|
||||
27, 42, 11, 3, 4, 13, 14, 15, -32, 20,
|
||||
-32, 24, 27, 46, 44, 19, 29, 45, 53, 55,
|
||||
0, 56, 0, 54, 28, 0, 0, 31
|
||||
48, 2, 49, 50, 38, 39, 40, 41, 42, 12,
|
||||
38, 39, 40, 41, 42, 18, 33, 3, 4, 19,
|
||||
19, 28, 43, 14, 15, 16, -33, 21, -33, 10,
|
||||
11, 25, 23, 28, 30, 47, 20, 32, 54, 46,
|
||||
45, 56, 29, 57, 55
|
||||
};
|
||||
|
||||
#define yypact_value_is_default(yystate) \
|
||||
((yystate) == (-16))
|
||||
((yystate) == (-15))
|
||||
|
||||
#define yytable_value_is_error(yytable_value) \
|
||||
YYID (0)
|
||||
|
||||
static const yytype_int8 yycheck[] =
|
||||
static const yytype_uint8 yycheck[] =
|
||||
{
|
||||
3, 4, 5, 7, 8, 9, 10, 11, 0, 7,
|
||||
8, 9, 10, 11, 3, 3, 17, 6, 6, 3,
|
||||
23, 25, 3, 15, 16, 12, 13, 14, 22, 3,
|
||||
24, 3, 23, 3, 24, 15, 22, 22, 45, 54,
|
||||
-1, 55, -1, 26, 23, -1, -1, 29
|
||||
3, 0, 5, 6, 8, 9, 10, 11, 12, 3,
|
||||
8, 9, 10, 11, 12, 3, 3, 16, 17, 7,
|
||||
7, 24, 26, 13, 14, 15, 23, 3, 25, 3,
|
||||
4, 3, 18, 24, 23, 3, 16, 30, 46, 23,
|
||||
25, 55, 24, 56, 27
|
||||
};
|
||||
|
||||
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||
symbol of state STATE-NUM. */
|
||||
static const yytype_uint8 yystos[] =
|
||||
{
|
||||
0, 28, 0, 15, 16, 29, 30, 31, 33, 34,
|
||||
3, 3, 36, 12, 13, 14, 37, 3, 6, 32,
|
||||
3, 35, 17, 40, 3, 38, 39, 23, 41, 22,
|
||||
42, 39, 3, 32, 43, 44, 45, 7, 8, 9,
|
||||
10, 11, 25, 46, 24, 22, 3, 3, 4, 5,
|
||||
41, 47, 48, 45, 26, 46, 48
|
||||
0, 29, 0, 16, 17, 30, 31, 32, 34, 35,
|
||||
3, 4, 3, 37, 13, 14, 15, 38, 3, 7,
|
||||
33, 3, 36, 18, 41, 3, 39, 40, 24, 42,
|
||||
23, 43, 40, 3, 33, 44, 45, 46, 8, 9,
|
||||
10, 11, 12, 26, 47, 25, 23, 3, 3, 5,
|
||||
6, 42, 48, 49, 46, 27, 47, 49
|
||||
};
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
@ -1559,9 +1561,9 @@ yyreduce:
|
||||
case 7:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 104 "config_parser.yy"
|
||||
#line 105 "config_parser.yy"
|
||||
{
|
||||
context->HandleInclude((yyvsp[(2) - (2)].text));
|
||||
context->HandleInclude((yyvsp[(2) - (2)].text), false);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1570,26 +1572,25 @@ yyreduce:
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 109 "config_parser.yy"
|
||||
{
|
||||
context->HandleLibrary((yyvsp[(2) - (2)].text));
|
||||
context->HandleInclude((yyvsp[(2) - (2)].text), true);
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
case 9:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 115 "config_parser.yy"
|
||||
#line 114 "config_parser.yy"
|
||||
{
|
||||
(yyval.text) = (yyvsp[(1) - (1)].text);
|
||||
context->HandleLibrary((yyvsp[(2) - (2)].text));
|
||||
}
|
||||
break;
|
||||
|
||||
case 11:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 121 "config_parser.yy"
|
||||
#line 120 "config_parser.yy"
|
||||
{
|
||||
m_Abstract = false;
|
||||
m_Local = false;
|
||||
(yyval.text) = (yyvsp[(1) - (1)].text);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1598,16 +1599,26 @@ yyreduce:
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 126 "config_parser.yy"
|
||||
{
|
||||
m_Item = boost::make_shared<ConfigItemBuilder>(yylloc);
|
||||
m_Item->SetType((yyvsp[(4) - (5)].text));
|
||||
m_Item->SetName((yyvsp[(5) - (5)].text));
|
||||
m_Abstract = false;
|
||||
m_Local = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 13:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 132 "config_parser.yy"
|
||||
#line 131 "config_parser.yy"
|
||||
{
|
||||
m_Item = boost::make_shared<ConfigItemBuilder>(yylloc);
|
||||
m_Item->SetType((yyvsp[(4) - (5)].text));
|
||||
m_Item->SetName((yyvsp[(5) - (5)].text));
|
||||
}
|
||||
break;
|
||||
|
||||
case 14:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 137 "config_parser.yy"
|
||||
{
|
||||
ExpressionList::Ptr exprl = *(yyvsp[(8) - (8)].variant);
|
||||
delete (yyvsp[(8) - (8)].variant);
|
||||
@ -1621,57 +1632,57 @@ yyreduce:
|
||||
}
|
||||
break;
|
||||
|
||||
case 16:
|
||||
case 17:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 150 "config_parser.yy"
|
||||
#line 155 "config_parser.yy"
|
||||
{
|
||||
m_Abstract = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 17:
|
||||
case 18:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 154 "config_parser.yy"
|
||||
#line 159 "config_parser.yy"
|
||||
{
|
||||
m_Local = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 20:
|
||||
case 21:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 164 "config_parser.yy"
|
||||
#line 169 "config_parser.yy"
|
||||
{
|
||||
m_Item->AddParent((yyvsp[(1) - (1)].text));
|
||||
free((yyvsp[(1) - (1)].text));
|
||||
}
|
||||
break;
|
||||
|
||||
case 23:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 175 "config_parser.yy"
|
||||
{
|
||||
m_ExpressionLists.push(boost::make_shared<ExpressionList>());
|
||||
}
|
||||
break;
|
||||
|
||||
case 24:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 180 "config_parser.yy"
|
||||
{
|
||||
m_ExpressionLists.push(boost::make_shared<ExpressionList>());
|
||||
}
|
||||
break;
|
||||
|
||||
case 25:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 185 "config_parser.yy"
|
||||
{
|
||||
(yyval.variant) = new Value(m_ExpressionLists.top());
|
||||
m_ExpressionLists.pop();
|
||||
}
|
||||
break;
|
||||
|
||||
case 30:
|
||||
case 31:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 195 "config_parser.yy"
|
||||
#line 200 "config_parser.yy"
|
||||
{
|
||||
Expression expr((yyvsp[(1) - (3)].text), (yyvsp[(2) - (3)].op), *(yyvsp[(3) - (3)].variant), yylloc);
|
||||
free((yyvsp[(1) - (3)].text));
|
||||
@ -1681,10 +1692,10 @@ yyreduce:
|
||||
}
|
||||
break;
|
||||
|
||||
case 31:
|
||||
case 32:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 203 "config_parser.yy"
|
||||
#line 208 "config_parser.yy"
|
||||
{
|
||||
Expression subexpr((yyvsp[(3) - (6)].text), (yyvsp[(5) - (6)].op), *(yyvsp[(6) - (6)].variant), yylloc);
|
||||
free((yyvsp[(3) - (6)].text));
|
||||
@ -1700,10 +1711,10 @@ yyreduce:
|
||||
}
|
||||
break;
|
||||
|
||||
case 32:
|
||||
case 33:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 217 "config_parser.yy"
|
||||
#line 222 "config_parser.yy"
|
||||
{
|
||||
Expression expr((yyvsp[(1) - (1)].text), OperatorSet, (yyvsp[(1) - (1)].text), yylloc);
|
||||
free((yyvsp[(1) - (1)].text));
|
||||
@ -1712,22 +1723,12 @@ yyreduce:
|
||||
}
|
||||
break;
|
||||
|
||||
case 37:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 230 "config_parser.yy"
|
||||
{
|
||||
(yyval.op) = (yyvsp[(1) - (1)].op);
|
||||
}
|
||||
break;
|
||||
|
||||
case 38:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 236 "config_parser.yy"
|
||||
#line 235 "config_parser.yy"
|
||||
{
|
||||
(yyval.variant) = new Value((yyvsp[(1) - (1)].text));
|
||||
free((yyvsp[(1) - (1)].text));
|
||||
(yyval.op) = (yyvsp[(1) - (1)].op);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1736,23 +1737,33 @@ yyreduce:
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 241 "config_parser.yy"
|
||||
{
|
||||
(yyval.variant) = new Value((yyvsp[(1) - (1)].num));
|
||||
(yyval.variant) = new Value((yyvsp[(1) - (1)].text));
|
||||
free((yyvsp[(1) - (1)].text));
|
||||
}
|
||||
break;
|
||||
|
||||
case 40:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 245 "config_parser.yy"
|
||||
#line 246 "config_parser.yy"
|
||||
{
|
||||
(yyval.variant) = new Value((yyvsp[(1) - (1)].num));
|
||||
}
|
||||
break;
|
||||
|
||||
case 41:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 250 "config_parser.yy"
|
||||
{
|
||||
(yyval.variant) = new Value();
|
||||
}
|
||||
break;
|
||||
|
||||
case 42:
|
||||
case 43:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 252 "config_parser.yy"
|
||||
#line 257 "config_parser.yy"
|
||||
{
|
||||
(yyval.variant) = (yyvsp[(1) - (1)].variant);
|
||||
}
|
||||
@ -1761,7 +1772,7 @@ yyreduce:
|
||||
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 1765 "config_parser.cc"
|
||||
#line 1776 "config_parser.cc"
|
||||
default: break;
|
||||
}
|
||||
/* User semantic actions sometimes alter yychar, and that requires
|
||||
@ -1999,6 +2010,6 @@ yyreturn:
|
||||
|
||||
|
||||
/* Line 2067 of yacc.c */
|
||||
#line 256 "config_parser.yy"
|
||||
#line 261 "config_parser.yy"
|
||||
|
||||
|
||||
|
@ -73,38 +73,40 @@ using namespace icinga;
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
T_STRING = 258,
|
||||
T_NUMBER = 259,
|
||||
T_NULL = 260,
|
||||
T_IDENTIFIER = 261,
|
||||
T_EQUAL = 262,
|
||||
T_PLUS_EQUAL = 263,
|
||||
T_MINUS_EQUAL = 264,
|
||||
T_MULTIPLY_EQUAL = 265,
|
||||
T_DIVIDE_EQUAL = 266,
|
||||
T_ABSTRACT = 267,
|
||||
T_LOCAL = 268,
|
||||
T_OBJECT = 269,
|
||||
T_INCLUDE = 270,
|
||||
T_LIBRARY = 271,
|
||||
T_INHERITS = 272
|
||||
T_STRING_ANGLE = 259,
|
||||
T_NUMBER = 260,
|
||||
T_NULL = 261,
|
||||
T_IDENTIFIER = 262,
|
||||
T_EQUAL = 263,
|
||||
T_PLUS_EQUAL = 264,
|
||||
T_MINUS_EQUAL = 265,
|
||||
T_MULTIPLY_EQUAL = 266,
|
||||
T_DIVIDE_EQUAL = 267,
|
||||
T_ABSTRACT = 268,
|
||||
T_LOCAL = 269,
|
||||
T_OBJECT = 270,
|
||||
T_INCLUDE = 271,
|
||||
T_LIBRARY = 272,
|
||||
T_INHERITS = 273
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define T_STRING 258
|
||||
#define T_NUMBER 259
|
||||
#define T_NULL 260
|
||||
#define T_IDENTIFIER 261
|
||||
#define T_EQUAL 262
|
||||
#define T_PLUS_EQUAL 263
|
||||
#define T_MINUS_EQUAL 264
|
||||
#define T_MULTIPLY_EQUAL 265
|
||||
#define T_DIVIDE_EQUAL 266
|
||||
#define T_ABSTRACT 267
|
||||
#define T_LOCAL 268
|
||||
#define T_OBJECT 269
|
||||
#define T_INCLUDE 270
|
||||
#define T_LIBRARY 271
|
||||
#define T_INHERITS 272
|
||||
#define T_STRING_ANGLE 259
|
||||
#define T_NUMBER 260
|
||||
#define T_NULL 261
|
||||
#define T_IDENTIFIER 262
|
||||
#define T_EQUAL 263
|
||||
#define T_PLUS_EQUAL 264
|
||||
#define T_MINUS_EQUAL 265
|
||||
#define T_MULTIPLY_EQUAL 266
|
||||
#define T_DIVIDE_EQUAL 267
|
||||
#define T_ABSTRACT 268
|
||||
#define T_LOCAL 269
|
||||
#define T_OBJECT 270
|
||||
#define T_INCLUDE 271
|
||||
#define T_LIBRARY 272
|
||||
#define T_INHERITS 273
|
||||
|
||||
|
||||
|
||||
@ -124,7 +126,7 @@ typedef union YYSTYPE
|
||||
|
||||
|
||||
/* Line 2068 of yacc.c */
|
||||
#line 128 "config_parser.h"
|
||||
#line 130 "config_parser.h"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
|
@ -43,6 +43,7 @@ using namespace icinga;
|
||||
}
|
||||
|
||||
%token <text> T_STRING
|
||||
%token <text> T_STRING_ANGLE
|
||||
%token <num> T_NUMBER
|
||||
%token T_NULL
|
||||
%token <text> T_IDENTIFIER
|
||||
@ -102,7 +103,11 @@ statement: object | include | library
|
||||
|
||||
include: T_INCLUDE T_STRING
|
||||
{
|
||||
context->HandleInclude($2);
|
||||
context->HandleInclude($2, false);
|
||||
}
|
||||
| T_INCLUDE T_STRING_ANGLE
|
||||
{
|
||||
context->HandleInclude($2, true);
|
||||
}
|
||||
|
||||
library: T_LIBRARY T_STRING
|
||||
|
@ -23,6 +23,8 @@ using std::ifstream;
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
vector<String> ConfigCompiler::m_IncludeSearchDirs;
|
||||
|
||||
/**
|
||||
* Constructor for the ConfigCompiler class.
|
||||
*
|
||||
@ -94,11 +96,12 @@ String ConfigCompiler::GetPath(void) const
|
||||
* function.
|
||||
*
|
||||
* @param include The path from the include directive.
|
||||
* @param search Whether to search global include dirs.
|
||||
*/
|
||||
void ConfigCompiler::HandleInclude(const String& include)
|
||||
void ConfigCompiler::HandleInclude(const String& include, bool search)
|
||||
{
|
||||
String path = Utility::DirName(GetPath()) + "/" + include;
|
||||
vector<ConfigItem::Ptr> items = m_HandleInclude(path);
|
||||
vector<ConfigItem::Ptr> items = m_HandleInclude(path, search);
|
||||
std::copy(items.begin(), items.end(), back_inserter(m_Result));
|
||||
}
|
||||
|
||||
@ -169,10 +172,26 @@ vector<ConfigItem::Ptr> ConfigCompiler::CompileText(const String& path,
|
||||
* @param include The path from the include directive.
|
||||
* @returns A list of configuration objects.
|
||||
*/
|
||||
vector<ConfigItem::Ptr> ConfigCompiler::HandleFileInclude(const String& include)
|
||||
vector<ConfigItem::Ptr> ConfigCompiler::HandleFileInclude(const String& include, bool search)
|
||||
{
|
||||
String includePath = include;
|
||||
|
||||
if (search) {
|
||||
String path;
|
||||
|
||||
BOOST_FOREACH(const String& dir, m_IncludeSearchDirs) {
|
||||
String path = dir + "/" + include;
|
||||
|
||||
struct stat statbuf;
|
||||
if (lstat(path.CStr(), &statbuf) >= 0) {
|
||||
includePath = path;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: implement wildcard includes */
|
||||
return CompileFile(include);
|
||||
return CompileFile(includePath);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,3 +203,14 @@ void ConfigCompiler::AddObject(const ConfigItem::Ptr& object)
|
||||
{
|
||||
m_Result.push_back(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a directory to the list of include search dirs.
|
||||
*
|
||||
* @param dir The new dir.
|
||||
*/
|
||||
void ConfigCompiler::AddIncludeSearchDir(const String& dir)
|
||||
{
|
||||
m_IncludeSearchDirs.push_back(dir);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace icinga
|
||||
class I2_CONFIG_API ConfigCompiler
|
||||
{
|
||||
public:
|
||||
typedef function<vector<ConfigItem::Ptr> (const String& include)> HandleIncludeFunc;
|
||||
typedef function<vector<ConfigItem::Ptr> (const String&, bool)> HandleIncludeFunc;
|
||||
|
||||
ConfigCompiler(const String& path, istream *input = &cin,
|
||||
HandleIncludeFunc includeHandler = &ConfigCompiler::HandleFileInclude);
|
||||
@ -46,14 +46,15 @@ public:
|
||||
static vector<ConfigItem::Ptr> CompileText(const String& path,
|
||||
const String& text);
|
||||
|
||||
static vector<ConfigItem::Ptr> HandleFileInclude(const String& include);
|
||||
static vector<ConfigItem::Ptr> HandleFileInclude(const String& include, bool search);
|
||||
static void AddIncludeSearchDir(const String& dir);
|
||||
|
||||
vector<ConfigItem::Ptr> GetResult(void) const;
|
||||
|
||||
String GetPath(void) const;
|
||||
|
||||
/* internally used methods */
|
||||
void HandleInclude(const String& include);
|
||||
void HandleInclude(const String& include, bool search);
|
||||
void HandleLibrary(const String& library);
|
||||
void AddObject(const ConfigItem::Ptr& object);
|
||||
size_t ReadInput(char *buffer, size_t max_bytes);
|
||||
@ -68,6 +69,8 @@ private:
|
||||
void *m_Scanner;
|
||||
vector<ConfigItem::Ptr> m_Result;
|
||||
|
||||
static vector<String> m_IncludeSearchDirs;
|
||||
|
||||
void InitializeScanner(void);
|
||||
void DestroyScanner(void);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user