mirror of https://github.com/Icinga/icinga2.git
Added support for compiling dictionaries/arrays.
This commit is contained in:
parent
ab624d0c92
commit
f5a817e62e
|
@ -14,6 +14,8 @@ libdyn_la_SOURCES = \
|
|||
config_lexer.ll \
|
||||
config_parser.yy \
|
||||
i2-dyn.h \
|
||||
dynamicdictionary.cpp \
|
||||
dynamicdictionary.h \
|
||||
dynamicobject.cpp \
|
||||
dynamicobject.h \
|
||||
objectset.cpp \
|
||||
|
|
|
@ -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 22
|
||||
#define YY_END_OF_BUFFER 23
|
||||
#define YY_NUM_RULES 26
|
||||
#define YY_END_OF_BUFFER 27
|
||||
/* This struct is not used in this scanner,
|
||||
but its presence is necessary. */
|
||||
struct yy_trans_info
|
||||
|
@ -379,15 +379,16 @@ struct yy_trans_info
|
|||
flex_int32_t yy_verify;
|
||||
flex_int32_t yy_nxt;
|
||||
};
|
||||
static yyconst flex_int16_t yy_accept[65] =
|
||||
static yyconst flex_int16_t yy_accept[72] =
|
||||
{ 0,
|
||||
0, 0, 0, 0, 23, 22, 21, 22, 22, 13,
|
||||
22, 8, 14, 6, 11, 12, 6, 6, 6, 6,
|
||||
9, 10, 17, 18, 21, 0, 20, 15, 0, 8,
|
||||
6, 6, 6, 6, 6, 17, 16, 7, 19, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 2, 6, 6, 6, 6, 3, 6, 4,
|
||||
6, 1, 5, 0
|
||||
0, 0, 0, 0, 27, 26, 25, 26, 26, 26,
|
||||
26, 13, 6, 26, 8, 14, 6, 11, 12, 6,
|
||||
6, 6, 6, 9, 10, 21, 22, 25, 0, 24,
|
||||
17, 15, 6, 16, 19, 0, 18, 8, 6, 6,
|
||||
6, 6, 21, 20, 7, 23, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 2,
|
||||
6, 6, 6, 6, 3, 6, 4, 6, 1, 5,
|
||||
0
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_ec[256] =
|
||||
|
@ -396,16 +397,16 @@ static yyconst flex_int32_t yy_ec[256] =
|
|||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
|
||||
1, 6, 1, 7, 1, 1, 8, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 1, 1, 1,
|
||||
10, 1, 1, 1, 11, 11, 11, 11, 11, 11,
|
||||
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
||||
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
||||
12, 1, 13, 1, 1, 1, 14, 15, 16, 17,
|
||||
1, 6, 7, 8, 9, 1, 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,
|
||||
14, 1, 15, 1, 13, 1, 16, 17, 18, 19,
|
||||
|
||||
18, 11, 11, 19, 20, 21, 11, 22, 11, 23,
|
||||
24, 11, 11, 25, 26, 27, 28, 11, 11, 11,
|
||||
11, 11, 29, 1, 30, 1, 1, 1, 1, 1,
|
||||
20, 13, 13, 21, 22, 23, 13, 24, 13, 25,
|
||||
26, 13, 13, 27, 28, 29, 30, 13, 13, 13,
|
||||
13, 13, 31, 1, 32, 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,
|
||||
|
@ -422,76 +423,87 @@ static yyconst flex_int32_t yy_ec[256] =
|
|||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_meta[31] =
|
||||
static yyconst flex_int32_t yy_meta[33] =
|
||||
{ 0,
|
||||
1, 1, 2, 3, 1, 4, 1, 1, 5, 1,
|
||||
5, 1, 1, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 1, 1
|
||||
5, 5, 5, 1, 1, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_base[71] =
|
||||
static yyconst flex_int16_t yy_base[78] =
|
||||
{ 0,
|
||||
0, 0, 87, 86, 91, 94, 29, 0, 0, 94,
|
||||
27, 81, 94, 0, 94, 94, 74, 65, 63, 71,
|
||||
94, 94, 0, 77, 34, 80, 0, 94, 0, 74,
|
||||
0, 56, 22, 65, 59, 0, 94, 94, 0, 52,
|
||||
56, 59, 62, 57, 49, 45, 47, 49, 54, 55,
|
||||
51, 47, 0, 36, 44, 35, 22, 0, 13, 0,
|
||||
13, 0, 0, 94, 41, 46, 51, 29, 56, 61
|
||||
0, 0, 127, 126, 128, 134, 31, 0, 0, 113,
|
||||
106, 134, 102, 29, 94, 134, 91, 134, 134, 25,
|
||||
24, 26, 28, 134, 134, 0, 91, 41, 96, 0,
|
||||
134, 134, 87, 134, 134, 0, 134, 87, 34, 35,
|
||||
36, 38, 0, 134, 134, 0, 39, 43, 45, 47,
|
||||
46, 48, 52, 57, 59, 58, 61, 60, 66, 85,
|
||||
62, 68, 69, 73, 84, 75, 83, 78, 82, 81,
|
||||
134, 106, 111, 116, 87, 121, 126
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_def[71] =
|
||||
static yyconst flex_int16_t yy_def[78] =
|
||||
{ 0,
|
||||
64, 1, 65, 65, 64, 64, 64, 66, 67, 64,
|
||||
64, 64, 64, 68, 64, 64, 68, 68, 68, 68,
|
||||
64, 64, 69, 64, 64, 66, 67, 64, 70, 64,
|
||||
68, 68, 68, 68, 68, 69, 64, 64, 70, 68,
|
||||
68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
|
||||
68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
|
||||
68, 68, 68, 0, 64, 64, 64, 64, 64, 64
|
||||
71, 1, 72, 72, 71, 71, 71, 73, 74, 71,
|
||||
71, 71, 75, 71, 71, 71, 75, 71, 71, 75,
|
||||
75, 75, 75, 71, 71, 76, 71, 71, 73, 74,
|
||||
71, 71, 75, 71, 71, 77, 71, 71, 75, 75,
|
||||
75, 75, 76, 71, 71, 77, 75, 75, 75, 75,
|
||||
75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
|
||||
75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
|
||||
0, 71, 71, 71, 71, 71, 71
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_nxt[125] =
|
||||
static yyconst flex_int16_t yy_nxt[167] =
|
||||
{ 0,
|
||||
6, 7, 7, 8, 9, 6, 10, 11, 12, 13,
|
||||
14, 15, 16, 17, 14, 14, 14, 14, 14, 18,
|
||||
14, 19, 14, 20, 14, 14, 14, 14, 21, 22,
|
||||
25, 25, 28, 31, 29, 25, 25, 41, 63, 62,
|
||||
42, 23, 23, 23, 23, 23, 26, 26, 61, 26,
|
||||
26, 27, 60, 27, 27, 27, 36, 36, 36, 59,
|
||||
36, 39, 58, 39, 39, 39, 57, 56, 55, 54,
|
||||
53, 52, 51, 50, 49, 48, 47, 46, 45, 44,
|
||||
43, 40, 30, 38, 37, 35, 34, 33, 32, 30,
|
||||
64, 24, 24, 5, 64, 64, 64, 64, 64, 64,
|
||||
6, 7, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 20, 17, 17, 17, 17,
|
||||
17, 21, 17, 22, 17, 23, 17, 17, 17, 17,
|
||||
24, 25, 28, 28, 35, 71, 71, 71, 36, 71,
|
||||
37, 39, 28, 28, 42, 71, 71, 71, 40, 71,
|
||||
71, 41, 48, 50, 71, 49, 71, 71, 71, 71,
|
||||
51, 47, 55, 71, 54, 56, 53, 52, 71, 71,
|
||||
71, 71, 71, 71, 57, 61, 62, 71, 63, 71,
|
||||
71, 58, 60, 59, 71, 66, 71, 64, 67, 71,
|
||||
65, 33, 71, 71, 71, 71, 71, 38, 71, 45,
|
||||
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64
|
||||
44, 68, 71, 69, 38, 70, 26, 26, 26, 26,
|
||||
26, 29, 29, 34, 29, 29, 30, 32, 30, 30,
|
||||
30, 43, 43, 43, 31, 43, 46, 71, 46, 46,
|
||||
46, 27, 27, 5, 71, 71, 71, 71, 71, 71,
|
||||
71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
|
||||
71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
|
||||
71, 71, 71, 71, 71, 71
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_chk[125] =
|
||||
static yyconst flex_int16_t yy_chk[167] =
|
||||
{ 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,
|
||||
7, 7, 11, 68, 11, 25, 25, 33, 61, 59,
|
||||
33, 65, 65, 65, 65, 65, 66, 66, 57, 66,
|
||||
66, 67, 56, 67, 67, 67, 69, 69, 69, 55,
|
||||
69, 70, 54, 70, 70, 70, 52, 51, 50, 49,
|
||||
48, 47, 46, 45, 44, 43, 42, 41, 40, 35,
|
||||
34, 32, 30, 26, 24, 20, 19, 18, 17, 12,
|
||||
5, 4, 3, 64, 64, 64, 64, 64, 64, 64,
|
||||
1, 1, 7, 7, 14, 21, 20, 22, 14, 23,
|
||||
14, 20, 28, 28, 23, 39, 40, 41, 21, 42,
|
||||
47, 22, 40, 41, 48, 40, 49, 51, 50, 52,
|
||||
42, 39, 50, 53, 49, 51, 48, 47, 54, 56,
|
||||
55, 58, 57, 61, 52, 56, 57, 59, 58, 62,
|
||||
63, 53, 55, 54, 64, 62, 66, 59, 63, 68,
|
||||
61, 75, 70, 69, 67, 65, 60, 38, 33, 29,
|
||||
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64
|
||||
27, 64, 17, 66, 15, 68, 72, 72, 72, 72,
|
||||
72, 73, 73, 13, 73, 73, 74, 11, 74, 74,
|
||||
74, 76, 76, 76, 10, 76, 77, 5, 77, 77,
|
||||
77, 4, 3, 71, 71, 71, 71, 71, 71, 71,
|
||||
71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
|
||||
71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
|
||||
71, 71, 71, 71, 71, 71
|
||||
} ;
|
||||
|
||||
/* Table of booleans, true if rule could match eol. */
|
||||
static yyconst flex_int32_t yy_rule_can_match_eol[23] =
|
||||
static yyconst flex_int32_t yy_rule_can_match_eol[27] =
|
||||
{ 0,
|
||||
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
|
||||
0, 1, 0, };
|
||||
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 1, 0, };
|
||||
|
||||
/* The intent behind this definition is that it'll catch
|
||||
* any uses of REJECT which flex missed.
|
||||
|
@ -502,6 +514,25 @@ static yyconst flex_int32_t yy_rule_can_match_eol[23] =
|
|||
#define YY_RESTORE_YY_MORE_OFFSET
|
||||
#line 1 "config_lexer.ll"
|
||||
#line 2 "config_lexer.ll"
|
||||
/******************************************************************************
|
||||
* Icinga 2 *
|
||||
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
|
||||
* *
|
||||
* 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 the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software Foundation *
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "i2-dyn.h"
|
||||
#include "config_parser.h"
|
||||
|
||||
|
@ -516,7 +547,7 @@ do { \
|
|||
} while (0)
|
||||
#define YY_NO_UNISTD_H 1
|
||||
|
||||
#line 520 "config_lexer.cc"
|
||||
#line 551 "config_lexer.cc"
|
||||
|
||||
#define INITIAL 0
|
||||
#define IN_C_COMMENT 1
|
||||
|
@ -763,9 +794,9 @@ YY_DECL
|
|||
register int yy_act;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
#line 22 "config_lexer.ll"
|
||||
#line 41 "config_lexer.ll"
|
||||
|
||||
#line 769 "config_lexer.cc"
|
||||
#line 800 "config_lexer.cc"
|
||||
|
||||
yylval = yylval_param;
|
||||
|
||||
|
@ -822,13 +853,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 >= 65 )
|
||||
if ( yy_current_state >= 72 )
|
||||
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 != 64 );
|
||||
while ( yy_current_state != 71 );
|
||||
yy_cp = yyg->yy_last_accepting_cpos;
|
||||
yy_current_state = yyg->yy_last_accepting_state;
|
||||
|
||||
|
@ -862,122 +893,142 @@ do_action: /* This label is used only to access EOF actions. */
|
|||
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 23 "config_lexer.ll"
|
||||
#line 42 "config_lexer.ll"
|
||||
return T_ABSTRACT;
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 24 "config_lexer.ll"
|
||||
#line 43 "config_lexer.ll"
|
||||
return T_LOCAL;
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 25 "config_lexer.ll"
|
||||
#line 44 "config_lexer.ll"
|
||||
return T_OBJECT;
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 26 "config_lexer.ll"
|
||||
#line 45 "config_lexer.ll"
|
||||
return T_INCLUDE;
|
||||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 27 "config_lexer.ll"
|
||||
#line 46 "config_lexer.ll"
|
||||
return T_INHERITS;
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 28 "config_lexer.ll"
|
||||
return T_IDENTIFIER;
|
||||
#line 47 "config_lexer.ll"
|
||||
{ yylval->text = strdup(yytext); return T_IDENTIFIER; }
|
||||
YY_BREAK
|
||||
case 7:
|
||||
/* rule 7 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 29 "config_lexer.ll"
|
||||
#line 48 "config_lexer.ll"
|
||||
{ yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING; }
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 30 "config_lexer.ll"
|
||||
#line 49 "config_lexer.ll"
|
||||
{ yylval->num = atoi(yytext); return T_NUMBER; }
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 31 "config_lexer.ll"
|
||||
#line 50 "config_lexer.ll"
|
||||
return T_OPEN_BRACE;
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 32 "config_lexer.ll"
|
||||
#line 51 "config_lexer.ll"
|
||||
return T_CLOSE_BRACE;
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 33 "config_lexer.ll"
|
||||
#line 52 "config_lexer.ll"
|
||||
return T_OPEN_BRACKET;
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 34 "config_lexer.ll"
|
||||
#line 53 "config_lexer.ll"
|
||||
return T_CLOSE_BRACKET;
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 35 "config_lexer.ll"
|
||||
#line 54 "config_lexer.ll"
|
||||
return T_COMMA;
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 36 "config_lexer.ll"
|
||||
return T_EQUAL;
|
||||
#line 55 "config_lexer.ll"
|
||||
{ yylval->op = OperatorSet; return T_EQUAL; }
|
||||
YY_BREAK
|
||||
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 39 "config_lexer.ll"
|
||||
BEGIN(IN_C_COMMENT);
|
||||
#line 56 "config_lexer.ll"
|
||||
{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
|
||||
YY_BREAK
|
||||
|
||||
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 43 "config_lexer.ll"
|
||||
BEGIN(INITIAL);
|
||||
#line 57 "config_lexer.ll"
|
||||
{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
|
||||
YY_BREAK
|
||||
case 17:
|
||||
/* rule 17 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 44 "config_lexer.ll"
|
||||
/* ignore comment */
|
||||
#line 58 "config_lexer.ll"
|
||||
{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
|
||||
YY_BREAK
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 45 "config_lexer.ll"
|
||||
/* ignore star */
|
||||
#line 59 "config_lexer.ll"
|
||||
{ yylval->op = OperatorDivide; return T_DIVIDE_EQUAL; }
|
||||
YY_BREAK
|
||||
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 48 "config_lexer.ll"
|
||||
/* ignore C++-style comments */
|
||||
#line 62 "config_lexer.ll"
|
||||
BEGIN(IN_C_COMMENT);
|
||||
YY_BREAK
|
||||
|
||||
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 49 "config_lexer.ll"
|
||||
/* ignore shell-style comments */
|
||||
#line 66 "config_lexer.ll"
|
||||
BEGIN(INITIAL);
|
||||
YY_BREAK
|
||||
case 21:
|
||||
/* rule 21 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 50 "config_lexer.ll"
|
||||
/* ignore whitespace */
|
||||
#line 67 "config_lexer.ll"
|
||||
/* ignore comment */
|
||||
YY_BREAK
|
||||
case 22:
|
||||
YY_RULE_SETUP
|
||||
#line 51 "config_lexer.ll"
|
||||
#line 68 "config_lexer.ll"
|
||||
/* ignore star */
|
||||
YY_BREAK
|
||||
|
||||
case 23:
|
||||
YY_RULE_SETUP
|
||||
#line 71 "config_lexer.ll"
|
||||
/* ignore C++-style comments */
|
||||
YY_BREAK
|
||||
case 24:
|
||||
YY_RULE_SETUP
|
||||
#line 72 "config_lexer.ll"
|
||||
/* ignore shell-style comments */
|
||||
YY_BREAK
|
||||
case 25:
|
||||
/* rule 25 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 73 "config_lexer.ll"
|
||||
/* ignore whitespace */
|
||||
YY_BREAK
|
||||
case 26:
|
||||
YY_RULE_SETUP
|
||||
#line 74 "config_lexer.ll"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 981 "config_lexer.cc"
|
||||
#line 1032 "config_lexer.cc"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(IN_C_COMMENT):
|
||||
yyterminate();
|
||||
|
@ -1273,7 +1324,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 >= 65 )
|
||||
if ( yy_current_state >= 72 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
|
@ -1302,11 +1353,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 >= 65 )
|
||||
if ( yy_current_state >= 72 )
|
||||
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 == 64);
|
||||
yy_is_jam = (yy_current_state == 71);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
@ -2165,7 +2216,7 @@ void yyfree (void * ptr , yyscan_t yyscanner)
|
|||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 51 "config_lexer.ll"
|
||||
#line 74 "config_lexer.ll"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,23 @@
|
|||
%{
|
||||
/******************************************************************************
|
||||
* Icinga 2 *
|
||||
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
|
||||
* *
|
||||
* 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 the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software Foundation *
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "i2-dyn.h"
|
||||
#include "config_parser.h"
|
||||
|
||||
|
@ -20,34 +39,38 @@ do { \
|
|||
%x IN_C_COMMENT
|
||||
|
||||
%%
|
||||
abstract return T_ABSTRACT;
|
||||
local return T_LOCAL;
|
||||
object return T_OBJECT;
|
||||
include return T_INCLUDE;
|
||||
inherits return T_INHERITS;
|
||||
[a-zA-Z][a-zA-Z0-9]* return T_IDENTIFIER;
|
||||
\"[^\"]+\" { yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING; }
|
||||
[0-9]+ { yylval->num = atoi(yytext); return T_NUMBER; }
|
||||
\{ return T_OPEN_BRACE;
|
||||
\} return T_CLOSE_BRACE;
|
||||
\[ return T_OPEN_BRACKET;
|
||||
\] return T_CLOSE_BRACKET;
|
||||
, return T_COMMA;
|
||||
= return T_EQUAL;
|
||||
abstract return T_ABSTRACT;
|
||||
local return T_LOCAL;
|
||||
object return T_OBJECT;
|
||||
include return T_INCLUDE;
|
||||
inherits return T_INHERITS;
|
||||
[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; }
|
||||
[0-9]+ { yylval->num = atoi(yytext); return T_NUMBER; }
|
||||
\{ return T_OPEN_BRACE;
|
||||
\} return T_CLOSE_BRACE;
|
||||
\[ return T_OPEN_BRACKET;
|
||||
\] return T_CLOSE_BRACKET;
|
||||
, return T_COMMA;
|
||||
= { yylval->op = OperatorSet; return T_EQUAL; }
|
||||
\+= { yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
|
||||
-= { yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
|
||||
\*= { yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
|
||||
\/= { yylval->op = OperatorDivide; return T_DIVIDE_EQUAL; }
|
||||
|
||||
<INITIAL>{
|
||||
"/*" BEGIN(IN_C_COMMENT);
|
||||
"/*" BEGIN(IN_C_COMMENT);
|
||||
}
|
||||
|
||||
<IN_C_COMMENT>{
|
||||
"*/" BEGIN(INITIAL);
|
||||
[^*]+ /* ignore comment */
|
||||
"*" /* ignore star */
|
||||
"*/" BEGIN(INITIAL);
|
||||
[^*]+ /* ignore comment */
|
||||
"*" /* ignore star */
|
||||
}
|
||||
|
||||
\/\/[^\n]+ /* ignore C++-style comments */
|
||||
#[^\n]+ /* ignore shell-style comments */
|
||||
[ \t\n]+ /* ignore whitespace */
|
||||
\/\/[^\n]+ /* ignore C++-style comments */
|
||||
#[^\n]+ /* ignore shell-style comments */
|
||||
[ \t\n]+ /* ignore whitespace */
|
||||
%%
|
||||
|
||||
|
||||
|
|
|
@ -65,9 +65,37 @@
|
|||
|
||||
/* Copy the first part of user declarations. */
|
||||
|
||||
/* Line 268 of yacc.c */
|
||||
#line 1 "config_parser.yy"
|
||||
|
||||
/******************************************************************************
|
||||
* Icinga 2 *
|
||||
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
|
||||
* *
|
||||
* 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 the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software Foundation *
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "i2-dyn.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
Variant *z;
|
||||
|
||||
|
||||
/* Line 268 of yacc.c */
|
||||
#line 71 "config_parser.cc"
|
||||
#line 99 "config_parser.cc"
|
||||
|
||||
/* Enabling traces. */
|
||||
#ifndef YYDEBUG
|
||||
|
@ -102,12 +130,16 @@
|
|||
T_OPEN_BRACKET = 263,
|
||||
T_CLOSE_BRACKET = 264,
|
||||
T_EQUAL = 265,
|
||||
T_COMMA = 266,
|
||||
T_ABSTRACT = 267,
|
||||
T_LOCAL = 268,
|
||||
T_OBJECT = 269,
|
||||
T_INCLUDE = 270,
|
||||
T_INHERITS = 271
|
||||
T_PLUS_EQUAL = 266,
|
||||
T_MINUS_EQUAL = 267,
|
||||
T_MULTIPLY_EQUAL = 268,
|
||||
T_DIVIDE_EQUAL = 269,
|
||||
T_COMMA = 270,
|
||||
T_ABSTRACT = 271,
|
||||
T_LOCAL = 272,
|
||||
T_OBJECT = 273,
|
||||
T_INCLUDE = 274,
|
||||
T_INHERITS = 275
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
|
@ -119,12 +151,16 @@
|
|||
#define T_OPEN_BRACKET 263
|
||||
#define T_CLOSE_BRACKET 264
|
||||
#define T_EQUAL 265
|
||||
#define T_COMMA 266
|
||||
#define T_ABSTRACT 267
|
||||
#define T_LOCAL 268
|
||||
#define T_OBJECT 269
|
||||
#define T_INCLUDE 270
|
||||
#define T_INHERITS 271
|
||||
#define T_PLUS_EQUAL 266
|
||||
#define T_MINUS_EQUAL 267
|
||||
#define T_MULTIPLY_EQUAL 268
|
||||
#define T_DIVIDE_EQUAL 269
|
||||
#define T_COMMA 270
|
||||
#define T_ABSTRACT 271
|
||||
#define T_LOCAL 272
|
||||
#define T_OBJECT 273
|
||||
#define T_INCLUDE 274
|
||||
#define T_INHERITS 275
|
||||
|
||||
|
||||
|
||||
|
@ -134,15 +170,17 @@ typedef union YYSTYPE
|
|||
{
|
||||
|
||||
/* Line 293 of yacc.c */
|
||||
#line 10 "config_parser.yy"
|
||||
#line 37 "config_parser.yy"
|
||||
|
||||
char *text;
|
||||
int num;
|
||||
icinga::Variant *variant;
|
||||
icinga::DynamicDictionaryOperator op;
|
||||
|
||||
|
||||
|
||||
/* Line 293 of yacc.c */
|
||||
#line 146 "config_parser.cc"
|
||||
#line 184 "config_parser.cc"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
|
@ -166,11 +204,8 @@ typedef struct YYLTYPE
|
|||
/* Copy the second part of user declarations. */
|
||||
|
||||
/* Line 343 of yacc.c */
|
||||
#line 30 "config_parser.yy"
|
||||
#line 68 "config_parser.yy"
|
||||
|
||||
#include "i2-dyn.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner);
|
||||
|
||||
|
@ -195,10 +230,12 @@ void ConfigContext::Compile(void)
|
|||
|
||||
#define scanner (context->GetScanner())
|
||||
|
||||
static stack<DynamicDictionary::Ptr> m_Dictionaries;
|
||||
|
||||
|
||||
|
||||
/* Line 343 of yacc.c */
|
||||
#line 202 "config_parser.cc"
|
||||
#line 239 "config_parser.cc"
|
||||
|
||||
#ifdef short
|
||||
# undef short
|
||||
|
@ -419,20 +456,20 @@ union yyalloc
|
|||
/* YYFINAL -- State number of the termination state. */
|
||||
#define YYFINAL 2
|
||||
/* YYLAST -- Last index in YYTABLE. */
|
||||
#define YYLAST 33
|
||||
#define YYLAST 39
|
||||
|
||||
/* YYNTOKENS -- Number of terminals. */
|
||||
#define YYNTOKENS 17
|
||||
#define YYNTOKENS 25
|
||||
/* YYNNTS -- Number of nonterminals. */
|
||||
#define YYNNTS 16
|
||||
#define YYNNTS 19
|
||||
/* YYNRULES -- Number of rules. */
|
||||
#define YYNRULES 30
|
||||
#define YYNRULES 37
|
||||
/* YYNRULES -- Number of states. */
|
||||
#define YYNSTATES 44
|
||||
#define YYNSTATES 51
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
#define YYUNDEFTOK 2
|
||||
#define YYMAXUTOK 271
|
||||
#define YYMAXUTOK 275
|
||||
|
||||
#define YYTRANSLATE(YYX) \
|
||||
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
|
@ -444,7 +481,7 @@ 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, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 23, 21, 2, 22, 2, 24, 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,
|
||||
|
@ -467,7 +504,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
|
||||
15, 16, 17, 18, 19, 20
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
|
@ -476,31 +513,33 @@ static const yytype_uint8 yytranslate[] =
|
|||
static const yytype_uint8 yyprhs[] =
|
||||
{
|
||||
0, 0, 3, 4, 7, 9, 11, 14, 17, 19,
|
||||
25, 28, 30, 32, 34, 36, 40, 41, 44, 48,
|
||||
49, 51, 55, 59, 61, 63, 65, 67, 71, 72,
|
||||
74
|
||||
25, 28, 30, 32, 34, 36, 40, 41, 44, 45,
|
||||
50, 51, 53, 57, 61, 63, 65, 67, 69, 71,
|
||||
73, 75, 77, 79, 80, 85, 86, 88
|
||||
};
|
||||
|
||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||
static const yytype_int8 yyrhs[] =
|
||||
{
|
||||
18, 0, -1, -1, 18, 19, -1, 21, -1, 20,
|
||||
-1, 15, 3, -1, 23, 22, -1, 22, -1, 14,
|
||||
5, 3, 26, 27, -1, 23, 24, -1, 24, -1,
|
||||
12, -1, 13, -1, 3, -1, 25, 11, 3, -1,
|
||||
-1, 16, 25, -1, 6, 28, 7, -1, -1, 29,
|
||||
-1, 28, 11, 29, -1, 5, 10, 30, -1, 3,
|
||||
-1, 4, -1, 31, -1, 27, -1, 8, 32, 9,
|
||||
-1, -1, 30, -1, 32, 11, 30, -1
|
||||
26, 0, -1, -1, 26, 27, -1, 29, -1, 28,
|
||||
-1, 19, 3, -1, 31, 30, -1, 30, -1, 18,
|
||||
5, 3, 34, 35, -1, 31, 32, -1, 32, -1,
|
||||
16, -1, 17, -1, 3, -1, 33, 15, 3, -1,
|
||||
-1, 20, 33, -1, -1, 6, 36, 37, 7, -1,
|
||||
-1, 38, -1, 37, 15, 38, -1, 5, 39, 40,
|
||||
-1, 10, -1, 11, -1, 12, -1, 13, -1, 14,
|
||||
-1, 3, -1, 4, -1, 41, -1, 35, -1, -1,
|
||||
8, 42, 43, 9, -1, -1, 40, -1, 43, 15,
|
||||
40, -1
|
||||
};
|
||||
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const yytype_uint8 yyrline[] =
|
||||
{
|
||||
0, 61, 61, 62, 65, 65, 68, 71, 72, 75,
|
||||
78, 79, 82, 83, 86, 87, 90, 91, 94, 97,
|
||||
98, 99, 102, 105, 105, 105, 105, 108, 111, 113,
|
||||
114
|
||||
0, 98, 98, 99, 102, 102, 105, 108, 109, 112,
|
||||
115, 116, 119, 120, 123, 124, 127, 128, 132, 131,
|
||||
146, 147, 148, 151, 160, 161, 162, 163, 164, 170,
|
||||
174, 178, 179, 186, 185, 200, 202, 208
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -511,11 +550,13 @@ static const char *const yytname[] =
|
|||
{
|
||||
"$end", "error", "$undefined", "T_STRING", "T_NUMBER", "T_IDENTIFIER",
|
||||
"T_OPEN_BRACE", "T_CLOSE_BRACE", "T_OPEN_BRACKET", "T_CLOSE_BRACKET",
|
||||
"T_EQUAL", "T_COMMA", "T_ABSTRACT", "T_LOCAL", "T_OBJECT", "T_INCLUDE",
|
||||
"T_INHERITS", "$accept", "statements", "statement", "include", "object",
|
||||
"object_declaration", "attributes_list", "attribute", "inherits_list",
|
||||
"inherits_specifier", "dictionary", "nvpairs", "nvpair", "value",
|
||||
"array", "arrayitems", 0
|
||||
"T_EQUAL", "T_PLUS_EQUAL", "T_MINUS_EQUAL", "T_MULTIPLY_EQUAL",
|
||||
"T_DIVIDE_EQUAL", "T_COMMA", "T_ABSTRACT", "T_LOCAL", "T_OBJECT",
|
||||
"T_INCLUDE", "T_INHERITS", "'+'", "'-'", "'*'", "'/'", "$accept",
|
||||
"statements", "statement", "include", "object", "object_declaration",
|
||||
"attributes_list", "attribute", "inherits_list", "inherits_specifier",
|
||||
"dictionary", "$@1", "nvpairs", "nvpair", "operator", "value", "array",
|
||||
"$@2", "arrayitems", 0
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -525,26 +566,27 @@ 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
|
||||
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
|
||||
275, 43, 45, 42, 47
|
||||
};
|
||||
# endif
|
||||
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const yytype_uint8 yyr1[] =
|
||||
{
|
||||
0, 17, 18, 18, 19, 19, 20, 21, 21, 22,
|
||||
23, 23, 24, 24, 25, 25, 26, 26, 27, 28,
|
||||
28, 28, 29, 30, 30, 30, 30, 31, 32, 32,
|
||||
32
|
||||
0, 25, 26, 26, 27, 27, 28, 29, 29, 30,
|
||||
31, 31, 32, 32, 33, 33, 34, 34, 36, 35,
|
||||
37, 37, 37, 38, 39, 39, 39, 39, 39, 40,
|
||||
40, 40, 40, 42, 41, 43, 43, 43
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
static const yytype_uint8 yyr2[] =
|
||||
{
|
||||
0, 2, 0, 2, 1, 1, 2, 2, 1, 5,
|
||||
2, 1, 1, 1, 1, 3, 0, 2, 3, 0,
|
||||
1, 3, 3, 1, 1, 1, 1, 3, 0, 1,
|
||||
3
|
||||
2, 1, 1, 1, 1, 3, 0, 2, 0, 4,
|
||||
0, 1, 3, 3, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 0, 4, 0, 1, 3
|
||||
};
|
||||
|
||||
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
|
||||
|
@ -554,35 +596,37 @@ static const yytype_uint8 yydefact[] =
|
|||
{
|
||||
2, 0, 1, 12, 13, 0, 0, 3, 5, 4,
|
||||
8, 0, 11, 0, 6, 7, 10, 16, 0, 0,
|
||||
14, 17, 19, 9, 0, 0, 0, 20, 15, 0,
|
||||
18, 0, 23, 24, 28, 26, 22, 25, 21, 29,
|
||||
0, 27, 0, 30
|
||||
14, 17, 18, 9, 0, 20, 15, 0, 0, 21,
|
||||
24, 25, 26, 27, 28, 0, 19, 0, 29, 30,
|
||||
33, 32, 23, 31, 22, 35, 36, 0, 34, 0,
|
||||
37
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yydefgoto[] =
|
||||
{
|
||||
-1, 1, 7, 8, 9, 10, 11, 12, 21, 19,
|
||||
35, 26, 27, 36, 37, 40
|
||||
41, 25, 28, 29, 35, 42, 43, 45, 47
|
||||
};
|
||||
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
#define YYPACT_NINF -34
|
||||
#define YYPACT_NINF -43
|
||||
static const yytype_int8 yypact[] =
|
||||
{
|
||||
-34, 0, -34, -34, -34, 1, 7, -34, -34, -34,
|
||||
-34, 4, -34, 8, -34, -34, -34, 6, 17, 18,
|
||||
-34, 12, 20, -34, 23, 19, -3, -34, -34, -1,
|
||||
-34, 20, -34, -34, -1, -34, -34, -34, -34, -34,
|
||||
10, -34, -1, -34
|
||||
-43, 0, -43, -43, -43, 9, 22, -43, -43, -43,
|
||||
-43, -12, -43, 23, -43, -43, -43, -8, 24, 25,
|
||||
-43, 13, -43, -43, 26, 27, -43, 10, -6, -43,
|
||||
-43, -43, -43, -43, -43, 7, -43, 27, -43, -43,
|
||||
-43, -43, -43, -43, -43, 7, -43, -7, -43, 7,
|
||||
-43
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yypgoto[] =
|
||||
{
|
||||
-34, -34, -34, -34, -34, 16, -34, 21, -34, -34,
|
||||
9, -34, 2, -33, -34, -34
|
||||
-43, -43, -43, -43, -43, 19, -43, 28, -43, -43,
|
||||
14, -43, -43, -3, -43, -42, -43, -43, -43
|
||||
};
|
||||
|
||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||
|
@ -591,35 +635,36 @@ static const yytype_int8 yypgoto[] =
|
|||
#define YYTABLE_NINF -1
|
||||
static const yytype_uint8 yytable[] =
|
||||
{
|
||||
2, 39, 32, 33, 30, 22, 13, 34, 31, 43,
|
||||
14, 17, 3, 4, 5, 6, 3, 4, 5, 41,
|
||||
20, 42, 18, 24, 22, 25, 28, 15, 23, 29,
|
||||
0, 0, 16, 38
|
||||
2, 36, 48, 46, 3, 4, 5, 50, 49, 37,
|
||||
38, 39, 18, 22, 13, 40, 3, 4, 5, 6,
|
||||
30, 31, 32, 33, 34, 14, 17, 20, 24, 26,
|
||||
15, 22, 27, 23, 44, 0, 0, 0, 0, 16
|
||||
};
|
||||
|
||||
#define yypact_value_is_default(yystate) \
|
||||
((yystate) == (-34))
|
||||
((yystate) == (-43))
|
||||
|
||||
#define yytable_value_is_error(yytable_value) \
|
||||
YYID (0)
|
||||
|
||||
static const yytype_int8 yycheck[] =
|
||||
{
|
||||
0, 34, 3, 4, 7, 6, 5, 8, 11, 42,
|
||||
3, 3, 12, 13, 14, 15, 12, 13, 14, 9,
|
||||
3, 11, 16, 11, 6, 5, 3, 11, 19, 10,
|
||||
-1, -1, 11, 31
|
||||
0, 7, 9, 45, 16, 17, 18, 49, 15, 15,
|
||||
3, 4, 20, 6, 5, 8, 16, 17, 18, 19,
|
||||
10, 11, 12, 13, 14, 3, 3, 3, 15, 3,
|
||||
11, 6, 5, 19, 37, -1, -1, -1, -1, 11
|
||||
};
|
||||
|
||||
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||
symbol of state STATE-NUM. */
|
||||
static const yytype_uint8 yystos[] =
|
||||
{
|
||||
0, 18, 0, 12, 13, 14, 15, 19, 20, 21,
|
||||
22, 23, 24, 5, 3, 22, 24, 3, 16, 26,
|
||||
3, 25, 6, 27, 11, 5, 28, 29, 3, 10,
|
||||
7, 11, 3, 4, 8, 27, 30, 31, 29, 30,
|
||||
32, 9, 11, 30
|
||||
0, 26, 0, 16, 17, 18, 19, 27, 28, 29,
|
||||
30, 31, 32, 5, 3, 30, 32, 3, 20, 34,
|
||||
3, 33, 6, 35, 15, 36, 3, 5, 37, 38,
|
||||
10, 11, 12, 13, 14, 39, 7, 15, 3, 4,
|
||||
8, 35, 40, 41, 38, 42, 40, 43, 9, 15,
|
||||
40
|
||||
};
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
|
@ -1502,10 +1547,124 @@ yyreduce:
|
|||
YY_REDUCE_PRINT (yyn);
|
||||
switch (yyn)
|
||||
{
|
||||
|
||||
case 18:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 1509 "config_parser.cc"
|
||||
#line 132 "config_parser.yy"
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = make_shared<DynamicDictionary>();
|
||||
m_Dictionaries.push(dictionary);
|
||||
}
|
||||
break;
|
||||
|
||||
case 19:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 138 "config_parser.yy"
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = m_Dictionaries.top();
|
||||
(yyval.variant) = new Variant(dictionary);
|
||||
|
||||
m_Dictionaries.pop();
|
||||
}
|
||||
break;
|
||||
|
||||
case 23:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 152 "config_parser.yy"
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = m_Dictionaries.top();
|
||||
dictionary->SetProperty((yyvsp[(1) - (3)].text), *(yyvsp[(3) - (3)].variant), (yyvsp[(2) - (3)].op));
|
||||
free((yyvsp[(1) - (3)].text));
|
||||
delete (yyvsp[(3) - (3)].variant);
|
||||
}
|
||||
break;
|
||||
|
||||
case 28:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 165 "config_parser.yy"
|
||||
{
|
||||
(yyval.op) = (yyvsp[(1) - (1)].op);
|
||||
}
|
||||
break;
|
||||
|
||||
case 29:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 171 "config_parser.yy"
|
||||
{
|
||||
(yyval.variant) = new Variant((yyvsp[(1) - (1)].text));
|
||||
}
|
||||
break;
|
||||
|
||||
case 30:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 175 "config_parser.yy"
|
||||
{
|
||||
(yyval.variant) = new Variant((yyvsp[(1) - (1)].num));
|
||||
}
|
||||
break;
|
||||
|
||||
case 32:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 180 "config_parser.yy"
|
||||
{
|
||||
(yyval.variant) = (yyvsp[(1) - (1)].variant);
|
||||
}
|
||||
break;
|
||||
|
||||
case 33:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 186 "config_parser.yy"
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = make_shared<DynamicDictionary>();
|
||||
m_Dictionaries.push(dictionary);
|
||||
}
|
||||
break;
|
||||
|
||||
case 34:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 192 "config_parser.yy"
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = m_Dictionaries.top();
|
||||
(yyval.variant) = new Variant(dictionary);
|
||||
|
||||
m_Dictionaries.pop();
|
||||
}
|
||||
break;
|
||||
|
||||
case 36:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 203 "config_parser.yy"
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = m_Dictionaries.top();
|
||||
//dictionary->AddUnnamedProperty(*$1);
|
||||
delete (yyvsp[(1) - (1)].variant);
|
||||
}
|
||||
break;
|
||||
|
||||
case 37:
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 209 "config_parser.yy"
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = m_Dictionaries.top();
|
||||
//dictionary->AddUnnamedProperty(*$3);
|
||||
delete (yyvsp[(3) - (3)].variant);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
/* Line 1806 of yacc.c */
|
||||
#line 1668 "config_parser.cc"
|
||||
default: break;
|
||||
}
|
||||
/* User semantic actions sometimes alter yychar, and that requires
|
||||
|
@ -1743,6 +1902,6 @@ yyreturn:
|
|||
|
||||
|
||||
/* Line 2067 of yacc.c */
|
||||
#line 116 "config_parser.yy"
|
||||
#line 215 "config_parser.yy"
|
||||
|
||||
|
||||
|
|
|
@ -45,12 +45,16 @@
|
|||
T_OPEN_BRACKET = 263,
|
||||
T_CLOSE_BRACKET = 264,
|
||||
T_EQUAL = 265,
|
||||
T_COMMA = 266,
|
||||
T_ABSTRACT = 267,
|
||||
T_LOCAL = 268,
|
||||
T_OBJECT = 269,
|
||||
T_INCLUDE = 270,
|
||||
T_INHERITS = 271
|
||||
T_PLUS_EQUAL = 266,
|
||||
T_MINUS_EQUAL = 267,
|
||||
T_MULTIPLY_EQUAL = 268,
|
||||
T_DIVIDE_EQUAL = 269,
|
||||
T_COMMA = 270,
|
||||
T_ABSTRACT = 271,
|
||||
T_LOCAL = 272,
|
||||
T_OBJECT = 273,
|
||||
T_INCLUDE = 274,
|
||||
T_INHERITS = 275
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
|
@ -62,12 +66,16 @@
|
|||
#define T_OPEN_BRACKET 263
|
||||
#define T_CLOSE_BRACKET 264
|
||||
#define T_EQUAL 265
|
||||
#define T_COMMA 266
|
||||
#define T_ABSTRACT 267
|
||||
#define T_LOCAL 268
|
||||
#define T_OBJECT 269
|
||||
#define T_INCLUDE 270
|
||||
#define T_INHERITS 271
|
||||
#define T_PLUS_EQUAL 266
|
||||
#define T_MINUS_EQUAL 267
|
||||
#define T_MULTIPLY_EQUAL 268
|
||||
#define T_DIVIDE_EQUAL 269
|
||||
#define T_COMMA 270
|
||||
#define T_ABSTRACT 271
|
||||
#define T_LOCAL 272
|
||||
#define T_OBJECT 273
|
||||
#define T_INCLUDE 274
|
||||
#define T_INHERITS 275
|
||||
|
||||
|
||||
|
||||
|
@ -77,15 +85,17 @@ typedef union YYSTYPE
|
|||
{
|
||||
|
||||
/* Line 2068 of yacc.c */
|
||||
#line 10 "config_parser.yy"
|
||||
#line 37 "config_parser.yy"
|
||||
|
||||
char *text;
|
||||
int num;
|
||||
icinga::Variant *variant;
|
||||
icinga::DynamicDictionaryOperator op;
|
||||
|
||||
|
||||
|
||||
/* Line 2068 of yacc.c */
|
||||
#line 89 "config_parser.h"
|
||||
#line 99 "config_parser.h"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
|
|
|
@ -1,3 +1,30 @@
|
|||
%{
|
||||
/******************************************************************************
|
||||
* Icinga 2 *
|
||||
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
|
||||
* *
|
||||
* 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 the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software Foundation *
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "i2-dyn.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
Variant *z;
|
||||
%}
|
||||
|
||||
%pure-parser
|
||||
|
||||
%locations
|
||||
|
@ -10,27 +37,35 @@
|
|||
%union {
|
||||
char *text;
|
||||
int num;
|
||||
icinga::Variant *variant;
|
||||
icinga::DynamicDictionaryOperator op;
|
||||
}
|
||||
|
||||
%token <text> T_STRING
|
||||
%token <num> T_NUMBER
|
||||
%token T_IDENTIFIER
|
||||
%token <text> T_IDENTIFIER
|
||||
%token T_OPEN_BRACE
|
||||
%token T_CLOSE_BRACE
|
||||
%token T_OPEN_BRACKET
|
||||
%token T_CLOSE_BRACKET
|
||||
%token T_EQUAL
|
||||
%token <op> T_EQUAL
|
||||
%token <op> T_PLUS_EQUAL
|
||||
%token <op> T_MINUS_EQUAL
|
||||
%token <op> T_MULTIPLY_EQUAL
|
||||
%token <op> T_DIVIDE_EQUAL
|
||||
%token T_COMMA
|
||||
%token T_ABSTRACT
|
||||
%token T_LOCAL
|
||||
%token T_OBJECT
|
||||
%token T_INCLUDE
|
||||
%token T_INHERITS
|
||||
|
||||
%type <variant> value
|
||||
%type <variant> array
|
||||
%type <variant> dictionary
|
||||
%type <op> operator
|
||||
%left '+' '-'
|
||||
%left '*' '/'
|
||||
%{
|
||||
#include "i2-dyn.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner);
|
||||
|
||||
|
@ -55,6 +90,8 @@ void ConfigContext::Compile(void)
|
|||
|
||||
#define scanner (context->GetScanner())
|
||||
|
||||
static stack<DynamicDictionary::Ptr> m_Dictionaries;
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
|
@ -91,7 +128,19 @@ inherits_specifier: /* empty */
|
|||
| T_INHERITS inherits_list
|
||||
;
|
||||
|
||||
dictionary: T_OPEN_BRACE nvpairs T_CLOSE_BRACE
|
||||
dictionary: T_OPEN_BRACE
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = make_shared<DynamicDictionary>();
|
||||
m_Dictionaries.push(dictionary);
|
||||
}
|
||||
nvpairs
|
||||
T_CLOSE_BRACE
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = m_Dictionaries.top();
|
||||
$$ = new Variant(dictionary);
|
||||
|
||||
m_Dictionaries.pop();
|
||||
}
|
||||
;
|
||||
|
||||
nvpairs: /* empty */
|
||||
|
@ -99,18 +148,68 @@ nvpairs: /* empty */
|
|||
| nvpairs T_COMMA nvpair
|
||||
;
|
||||
|
||||
nvpair: T_IDENTIFIER T_EQUAL value
|
||||
nvpair: T_IDENTIFIER operator value
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = m_Dictionaries.top();
|
||||
dictionary->SetProperty($1, *$3, $2);
|
||||
free($1);
|
||||
delete $3;
|
||||
}
|
||||
;
|
||||
|
||||
value: T_STRING | T_NUMBER | array | dictionary
|
||||
operator: T_EQUAL
|
||||
| T_PLUS_EQUAL
|
||||
| T_MINUS_EQUAL
|
||||
| T_MULTIPLY_EQUAL
|
||||
| T_DIVIDE_EQUAL
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
;
|
||||
|
||||
array: T_OPEN_BRACKET arrayitems T_CLOSE_BRACKET
|
||||
value: T_STRING
|
||||
{
|
||||
$$ = new Variant($1);
|
||||
}
|
||||
| T_NUMBER
|
||||
{
|
||||
$$ = new Variant($1);
|
||||
}
|
||||
| array
|
||||
| dictionary
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
;
|
||||
|
||||
array: T_OPEN_BRACKET
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = make_shared<DynamicDictionary>();
|
||||
m_Dictionaries.push(dictionary);
|
||||
}
|
||||
arrayitems
|
||||
T_CLOSE_BRACKET
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = m_Dictionaries.top();
|
||||
$$ = new Variant(dictionary);
|
||||
|
||||
m_Dictionaries.pop();
|
||||
}
|
||||
;
|
||||
|
||||
arrayitems:
|
||||
/* empty */
|
||||
| value
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = m_Dictionaries.top();
|
||||
//dictionary->AddUnnamedProperty(*$1);
|
||||
delete $1;
|
||||
}
|
||||
| arrayitems T_COMMA value
|
||||
{
|
||||
DynamicDictionary::Ptr dictionary = m_Dictionaries.top();
|
||||
//dictionary->AddUnnamedProperty(*$3);
|
||||
delete $3;
|
||||
}
|
||||
;
|
||||
%%
|
||||
|
|
|
@ -20,3 +20,7 @@
|
|||
#include "i2-dyn.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
DynamicDictionary::DynamicDictionary(void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include <i2-base.h>
|
||||
|
||||
#include <stack>
|
||||
|
||||
#ifdef I2_DYN_BUILD
|
||||
# define I2_DYN_API I2_EXPORT
|
||||
#else /* I2_DYN_BUILD */
|
||||
|
|
|
@ -4,9 +4,7 @@ using namespace icinga;
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
stringstream config;
|
||||
config << "object process \"foo\" {}";
|
||||
ConfigContext ctx(&config);
|
||||
yyparse(&ctx);
|
||||
ConfigContext ctx;
|
||||
ctx.Compile();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue