Bugfixes for the config compiler.

This commit is contained in:
Gunnar Beutner 2012-06-05 15:59:28 +02:00
parent 9b8fd9755b
commit c65a87068f
6 changed files with 240 additions and 331 deletions

View File

@ -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 30
#define YY_END_OF_BUFFER 31
#define YY_NUM_RULES 23
#define YY_END_OF_BUFFER 24
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@ -379,16 +379,16 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[79] =
static yyconst flex_int16_t yy_accept[72] =
{ 0,
0, 0, 0, 0, 31, 29, 28, 28, 29, 29,
10, 11, 29, 29, 16, 7, 29, 9, 17, 7,
14, 15, 7, 7, 7, 7, 7, 12, 13, 24,
25, 28, 0, 27, 20, 18, 7, 19, 22, 0,
21, 9, 7, 7, 7, 7, 7, 24, 23, 8,
26, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 6, 7, 7, 7, 7, 2, 7, 7, 7,
7, 3, 7, 4, 7, 1, 5, 0
0, 0, 0, 0, 24, 22, 21, 21, 22, 22,
22, 22, 22, 22, 9, 10, 7, 7, 7, 7,
7, 7, 17, 18, 21, 0, 20, 13, 11, 12,
15, 0, 14, 9, 7, 7, 7, 7, 7, 7,
17, 16, 8, 19, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 6, 7, 7, 7, 7, 2,
7, 7, 7, 7, 3, 7, 4, 7, 1, 5,
0
} ;
static yyconst flex_int32_t yy_ec[256] =
@ -396,17 +396,17 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
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, 6,
7, 8, 9, 10, 11, 1, 12, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 1, 1, 1,
14, 1, 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,
16, 1, 17, 1, 15, 1, 18, 19, 20, 21,
1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
1, 6, 7, 1, 8, 1, 9, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 1, 1, 1,
11, 1, 1, 1, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
1, 1, 1, 1, 1, 1, 13, 14, 15, 16,
22, 15, 15, 23, 24, 25, 15, 26, 15, 27,
28, 15, 15, 29, 30, 31, 32, 15, 15, 15,
15, 15, 33, 1, 34, 1, 1, 1, 1, 1,
17, 12, 12, 18, 19, 20, 12, 21, 12, 22,
23, 12, 12, 24, 25, 26, 27, 12, 12, 12,
12, 12, 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,
@ -423,91 +423,78 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
static yyconst flex_int32_t yy_meta[35] =
static yyconst flex_int32_t yy_meta[28] =
{ 0,
1, 1, 2, 3, 1, 1, 1, 4, 1, 1,
5, 1, 5, 5, 5, 1, 1, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 1, 1
1, 1, 2, 3, 1, 4, 1, 5, 1, 5,
1, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5
} ;
static yyconst flex_int16_t yy_base[85] =
static yyconst flex_int16_t yy_base[78] =
{ 0,
0, 0, 136, 135, 142, 145, 33, 35, 0, 0,
145, 145, 124, 121, 145, 114, 31, 111, 145, 99,
145, 145, 27, 26, 28, 30, 33, 145, 145, 0,
100, 46, 107, 0, 145, 145, 96, 145, 145, 0,
145, 96, 36, 37, 41, 44, 40, 0, 145, 145,
0, 45, 49, 50, 53, 54, 55, 59, 60, 64,
65, 94, 67, 68, 69, 70, 93, 71, 75, 82,
83, 92, 84, 91, 86, 89, 87, 145, 116, 121,
126, 94, 131, 136
0, 0, 93, 92, 97, 100, 26, 28, 0, 0,
85, 84, 83, 26, 83, 100, 0, 78, 69, 67,
62, 74, 0, 78, 31, 82, 0, 100, 100, 100,
100, 0, 100, 75, 0, 59, 21, 68, 61, 61,
0, 100, 100, 0, 54, 58, 61, 64, 55, 58,
50, 46, 48, 50, 0, 55, 56, 52, 48, 0,
40, 50, 44, 32, 0, 25, 0, 22, 0, 0,
100, 39, 44, 49, 33, 54, 59
} ;
static yyconst flex_int16_t yy_def[85] =
static yyconst flex_int16_t yy_def[78] =
{ 0,
78, 1, 79, 79, 78, 78, 78, 78, 80, 81,
78, 78, 78, 78, 78, 82, 78, 78, 78, 82,
78, 78, 82, 82, 82, 82, 82, 78, 78, 83,
78, 78, 80, 81, 78, 78, 82, 78, 78, 84,
78, 78, 82, 82, 82, 82, 82, 83, 78, 78,
84, 82, 82, 82, 82, 82, 82, 82, 82, 82,
82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
82, 82, 82, 82, 82, 82, 82, 0, 78, 78,
78, 78, 78, 78
71, 1, 72, 72, 71, 71, 71, 71, 73, 74,
71, 71, 71, 71, 71, 71, 75, 75, 75, 75,
75, 75, 76, 71, 71, 73, 74, 71, 71, 71,
71, 77, 71, 71, 75, 75, 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, 75, 75,
0, 71, 71, 71, 71, 71, 71
} ;
static yyconst flex_int16_t yy_nxt[180] =
static yyconst flex_int16_t yy_nxt[128] =
{ 0,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 20, 20,
20, 20, 20, 24, 20, 25, 26, 27, 20, 20,
20, 20, 28, 29, 32, 32, 32, 32, 39, 78,
78, 78, 40, 78, 41, 43, 78, 32, 32, 78,
78, 47, 44, 78, 78, 45, 53, 78, 78, 54,
55, 46, 78, 78, 57, 52, 78, 78, 78, 56,
61, 60, 78, 78, 59, 58, 63, 78, 78, 62,
78, 78, 78, 78, 78, 69, 68, 64, 78, 70,
67, 65, 66, 71, 73, 78, 78, 78, 37, 78,
16, 17, 18, 17, 17, 17, 17, 17, 19, 17,
20, 21, 22, 17, 17, 17, 17, 25, 25, 25,
25, 31, 25, 25, 32, 46, 33, 35, 47, 23,
23, 23, 23, 23, 26, 26, 70, 26, 26, 27,
69, 27, 27, 27, 41, 41, 41, 68, 41, 44,
67, 44, 44, 44, 66, 65, 64, 63, 62, 61,
60, 59, 58, 57, 56, 55, 54, 53, 52, 51,
50, 49, 48, 45, 34, 43, 42, 40, 39, 38,
37, 36, 34, 30, 29, 28, 71, 24, 24, 5,
78, 72, 78, 74, 78, 78, 78, 78, 42, 78,
50, 49, 78, 75, 76, 77, 30, 30, 30, 30,
30, 33, 33, 42, 33, 33, 34, 38, 34, 34,
34, 48, 48, 48, 36, 48, 51, 35, 51, 51,
51, 78, 31, 31, 5, 78, 78, 78, 78, 78,
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
78, 78, 78, 78, 78, 78, 78, 78, 78
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[180] =
static yyconst flex_int16_t yy_chk[128] =
{ 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, 1, 1, 1, 7, 7, 8, 8, 17, 24,
23, 25, 17, 26, 17, 23, 27, 32, 32, 43,
44, 27, 24, 47, 45, 25, 44, 46, 52, 44,
45, 26, 53, 54, 47, 43, 55, 56, 57, 46,
55, 54, 58, 59, 53, 52, 57, 60, 61, 56,
63, 64, 65, 66, 68, 64, 63, 58, 69, 65,
61, 59, 60, 66, 69, 70, 71, 73, 82, 75,
1, 1, 1, 1, 1, 1, 1, 7, 7, 8,
8, 14, 25, 25, 14, 37, 14, 75, 37, 72,
72, 72, 72, 72, 73, 73, 68, 73, 73, 74,
66, 74, 74, 74, 76, 76, 76, 64, 76, 77,
63, 77, 77, 77, 62, 61, 59, 58, 57, 56,
54, 53, 52, 51, 50, 49, 48, 47, 46, 45,
40, 39, 38, 36, 34, 26, 24, 22, 21, 20,
19, 18, 15, 13, 12, 11, 5, 4, 3, 71,
77, 68, 76, 70, 74, 72, 67, 62, 42, 37,
33, 31, 20, 71, 73, 75, 79, 79, 79, 79,
79, 80, 80, 18, 80, 80, 81, 16, 81, 81,
81, 83, 83, 83, 14, 83, 84, 13, 84, 84,
84, 5, 4, 3, 78, 78, 78, 78, 78, 78,
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
78, 78, 78, 78, 78, 78, 78, 78, 78
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[31] =
static yyconst flex_int32_t yy_rule_can_match_eol[24] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, };
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 1, 0, 0, };
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
@ -551,7 +538,7 @@ do { \
} while (0)
#define YY_NO_UNISTD_H 1
#line 555 "config_lexer.cc"
#line 542 "config_lexer.cc"
#define INITIAL 0
#define IN_C_COMMENT 1
@ -800,7 +787,7 @@ YY_DECL
#line 41 "config_lexer.ll"
#line 804 "config_lexer.cc"
#line 791 "config_lexer.cc"
yylval = yylval_param;
@ -857,13 +844,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 >= 79 )
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 != 78 );
while ( yy_current_state != 71 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
@ -944,115 +931,80 @@ YY_RULE_SETUP
case 10:
YY_RULE_SETUP
#line 51 "config_lexer.ll"
return T_OPEN_PARENTHESIS;
{ yylval->op = OperatorSet; return T_EQUAL; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 52 "config_lexer.ll"
return T_CLOSE_PARENTHESIS;
{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 53 "config_lexer.ll"
return T_OPEN_BRACE;
{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 54 "config_lexer.ll"
return T_CLOSE_BRACE;
{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 55 "config_lexer.ll"
return T_OPEN_BRACKET;
YY_BREAK
case 15:
YY_RULE_SETUP
#line 56 "config_lexer.ll"
return T_CLOSE_BRACKET;
YY_BREAK
case 16:
YY_RULE_SETUP
#line 57 "config_lexer.ll"
return T_COMMA;
YY_BREAK
case 17:
YY_RULE_SETUP
#line 58 "config_lexer.ll"
{ yylval->op = OperatorSet; return T_EQUAL; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 59 "config_lexer.ll"
{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 60 "config_lexer.ll"
{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 61 "config_lexer.ll"
{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 62 "config_lexer.ll"
{ yylval->op = OperatorDivide; return T_DIVIDE_EQUAL; }
YY_BREAK
case 22:
case 15:
YY_RULE_SETUP
#line 65 "config_lexer.ll"
#line 58 "config_lexer.ll"
BEGIN(IN_C_COMMENT);
YY_BREAK
case 23:
case 16:
YY_RULE_SETUP
#line 69 "config_lexer.ll"
#line 62 "config_lexer.ll"
BEGIN(INITIAL);
YY_BREAK
case 24:
/* rule 24 can match eol */
case 17:
/* rule 17 can match eol */
YY_RULE_SETUP
#line 70 "config_lexer.ll"
#line 63 "config_lexer.ll"
/* ignore comment */
YY_BREAK
case 25:
case 18:
YY_RULE_SETUP
#line 71 "config_lexer.ll"
#line 64 "config_lexer.ll"
/* ignore star */
YY_BREAK
case 26:
case 19:
YY_RULE_SETUP
#line 74 "config_lexer.ll"
#line 67 "config_lexer.ll"
/* ignore C++-style comments */
YY_BREAK
case 27:
case 20:
YY_RULE_SETUP
#line 75 "config_lexer.ll"
#line 68 "config_lexer.ll"
/* ignore shell-style comments */
YY_BREAK
case 28:
/* rule 28 can match eol */
case 21:
/* rule 21 can match eol */
YY_RULE_SETUP
#line 76 "config_lexer.ll"
#line 69 "config_lexer.ll"
/* ignore whitespace */
YY_BREAK
case 29:
case 22:
YY_RULE_SETUP
#line 78 "config_lexer.ll"
#line 71 "config_lexer.ll"
return yytext[0];
YY_BREAK
case 30:
case 23:
YY_RULE_SETUP
#line 79 "config_lexer.ll"
#line 72 "config_lexer.ll"
ECHO;
YY_BREAK
#line 1056 "config_lexer.cc"
#line 1008 "config_lexer.cc"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(IN_C_COMMENT):
yyterminate();
@ -1348,7 +1300,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 >= 79 )
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];
@ -1377,11 +1329,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 >= 79 )
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 == 78);
yy_is_jam = (yy_current_state == 71);
return yy_is_jam ? 0 : yy_current_state;
}
@ -2240,7 +2192,7 @@ void yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
#line 79 "config_lexer.ll"
#line 72 "config_lexer.ll"

View File

@ -45,16 +45,9 @@ object return T_OBJECT;
include return T_INCLUDE;
inherits return T_INHERITS;
null return T_NULL;
[a-zA-Z\-_][a-zA-Z0-9\-_]* { yylval->text = strdup(yytext); return T_IDENTIFIER; }
[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_PARENTHESIS;
\) return T_CLOSE_PARENTHESIS;
\{ 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; }

View File

@ -125,23 +125,16 @@ using namespace icinga;
T_NUMBER = 259,
T_NULL = 260,
T_IDENTIFIER = 261,
T_OPEN_PARENTHESIS = 262,
T_CLOSE_PARENTHESIS = 263,
T_OPEN_BRACE = 264,
T_CLOSE_BRACE = 265,
T_OPEN_BRACKET = 266,
T_CLOSE_BRACKET = 267,
T_EQUAL = 268,
T_PLUS_EQUAL = 269,
T_MINUS_EQUAL = 270,
T_MULTIPLY_EQUAL = 271,
T_DIVIDE_EQUAL = 272,
T_COMMA = 273,
T_ABSTRACT = 274,
T_LOCAL = 275,
T_OBJECT = 276,
T_INCLUDE = 277,
T_INHERITS = 278
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_INHERITS = 271
};
#endif
/* Tokens. */
@ -149,23 +142,16 @@ using namespace icinga;
#define T_NUMBER 259
#define T_NULL 260
#define T_IDENTIFIER 261
#define T_OPEN_PARENTHESIS 262
#define T_CLOSE_PARENTHESIS 263
#define T_OPEN_BRACE 264
#define T_CLOSE_BRACE 265
#define T_OPEN_BRACKET 266
#define T_CLOSE_BRACKET 267
#define T_EQUAL 268
#define T_PLUS_EQUAL 269
#define T_MINUS_EQUAL 270
#define T_MULTIPLY_EQUAL 271
#define T_DIVIDE_EQUAL 272
#define T_COMMA 273
#define T_ABSTRACT 274
#define T_LOCAL 275
#define T_OBJECT 276
#define T_INCLUDE 277
#define T_INHERITS 278
#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_INHERITS 271
@ -185,7 +171,7 @@ typedef union YYSTYPE
/* Line 293 of yacc.c */
#line 189 "config_parser.cc"
#line 175 "config_parser.cc"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@ -209,7 +195,7 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */
/* Line 343 of yacc.c */
#line 71 "config_parser.yy"
#line 64 "config_parser.yy"
int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner);
@ -244,7 +230,7 @@ static Dictionary::Ptr m_Array;
/* Line 343 of yacc.c */
#line 248 "config_parser.cc"
#line 234 "config_parser.cc"
#ifdef short
# undef short
@ -465,7 +451,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 46
#define YYLAST 47
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 28
@ -478,7 +464,7 @@ union yyalloc
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 278
#define YYMAXUTOK 271
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@ -490,15 +476,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, 26, 24, 2, 25, 2, 27, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
26, 27, 19, 17, 21, 18, 2, 20, 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, 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, 22, 2, 23, 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,
@ -513,7 +499,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, 18, 19, 20, 21, 22, 23
15, 16
};
#if YYDEBUG
@ -532,26 +518,26 @@ static const yytype_uint8 yyprhs[] =
static const yytype_int8 yyrhs[] =
{
29, 0, -1, -1, 29, 30, -1, 32, -1, 31,
-1, 22, 3, -1, -1, -1, 33, 35, 21, 6,
3, 34, 39, 40, -1, -1, 35, 36, -1, 19,
-1, 20, -1, 38, -1, 37, 18, 38, -1, 3,
-1, -1, 23, 37, -1, -1, 9, 41, 42, 10,
-1, -1, 43, -1, 43, 18, 42, -1, 6, 44,
46, -1, 6, 11, 3, 12, 44, 46, -1, 3,
-1, 13, -1, 14, -1, 15, -1, 16, -1, 17,
-1, 15, 3, -1, -1, -1, 33, 35, 14, 6,
3, 34, 39, 40, -1, -1, 35, 36, -1, 12,
-1, 13, -1, 38, -1, 37, 21, 38, -1, 3,
-1, -1, 16, 37, -1, -1, 22, 41, 42, 23,
-1, -1, 43, -1, 43, 21, 42, -1, 6, 44,
46, -1, 6, 24, 3, 25, 44, 46, -1, 3,
-1, 7, -1, 8, -1, 9, -1, 10, -1, 11,
-1, 3, -1, 4, -1, 5, -1, 45, -1, 47,
-1, 40, -1, -1, 7, 48, 50, 8, -1, 45,
-1, -1, 49, -1, 49, 18, 50, -1
-1, 40, -1, -1, 26, 48, 50, 27, -1, 45,
-1, -1, 49, -1, 49, 21, 50, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 105, 105, 106, 112, 112, 115, 119, 124, 119,
155, 156, 159, 163, 169, 170, 173, 179, 180, 184,
183, 195, 196, 197, 200, 208, 221, 230, 231, 232,
233, 234, 240, 244, 248, 254, 255, 256, 263, 262,
274, 280, 282, 283
0, 98, 98, 99, 105, 105, 108, 112, 117, 112,
148, 149, 152, 156, 162, 163, 166, 172, 173, 177,
176, 188, 189, 190, 193, 201, 214, 223, 224, 225,
226, 227, 233, 237, 241, 247, 248, 249, 256, 255,
267, 273, 275, 276
};
#endif
@ -561,16 +547,14 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "T_STRING", "T_NUMBER", "T_NULL",
"T_IDENTIFIER", "T_OPEN_PARENTHESIS", "T_CLOSE_PARENTHESIS",
"T_OPEN_BRACE", "T_CLOSE_BRACE", "T_OPEN_BRACKET", "T_CLOSE_BRACKET",
"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", "$@1", "$@2",
"attributes", "attribute", "inherits_list", "inherits_item",
"inherits_specifier", "expressionlist", "$@3", "expressions",
"expression", "operator", "simplevalue", "value", "tuple", "$@4",
"tupleitem", "tupleitems", 0
"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_INHERITS", "'+'", "'-'", "'*'", "'/'", "','",
"'{'", "'}'", "'['", "']'", "'('", "')'", "$accept", "statements",
"statement", "include", "object", "$@1", "$@2", "attributes",
"attribute", "inherits_list", "inherits_item", "inherits_specifier",
"expressionlist", "$@3", "expressions", "expression", "operator",
"simplevalue", "value", "tuple", "$@4", "tupleitem", "tupleitems", 0
};
#endif
@ -580,8 +564,8 @@ 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, 273, 274,
275, 276, 277, 278, 43, 45, 42, 47
265, 266, 267, 268, 269, 270, 271, 43, 45, 42,
47, 44, 123, 125, 91, 93, 40, 41
};
# endif
@ -613,7 +597,7 @@ static const yytype_uint8 yydefact[] =
2, 7, 1, 0, 3, 5, 4, 10, 6, 0,
12, 13, 0, 11, 0, 8, 17, 0, 0, 16,
18, 14, 19, 9, 0, 21, 15, 26, 0, 0,
22, 0, 27, 28, 29, 30, 31, 0, 20, 21,
22, 27, 28, 29, 30, 31, 0, 0, 20, 21,
0, 32, 33, 34, 38, 37, 35, 24, 36, 23,
0, 41, 0, 40, 42, 0, 25, 41, 39, 43
};
@ -628,23 +612,23 @@ static const yytype_int8 yydefgoto[] =
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
#define YYPACT_NINF -41
#define YYPACT_NINF -44
static const yytype_int8 yypact[] =
{
-41, 0, -41, -1, -41, -41, -41, -41, -41, 9,
-41, -41, 7, -41, 13, -41, 8, 29, 24, -41,
17, -41, -41, -41, 29, 12, -41, -41, -10, 26,
19, 31, -41, -41, -41, -41, -41, 5, -41, 12,
27, -41, -41, -41, -41, -41, -41, -41, -41, -41,
10, 16, 5, -41, 20, 32, -41, 16, -41, -41
-44, 9, -44, 8, -44, -44, -44, -44, -44, 3,
-44, -44, 6, -44, 15, -44, 5, 19, 11, -44,
13, -44, -44, -44, 19, 7, -44, -44, -4, 12,
16, -44, -44, -44, -44, -44, 33, -3, -44, 7,
14, -44, -44, -44, -44, -44, -44, -44, -44, -44,
18, 27, -3, -44, 17, 20, -44, 27, -44, -44
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
-41, -41, -41, -41, -41, -41, -41, -41, -41, -41,
18, -41, 23, -41, 4, -41, -6, -40, -7, -41,
-41, -41, -11
-44, -44, -44, -44, -44, -44, -44, -44, -44, -44,
21, -44, 22, -44, 2, -44, -8, -43, -9, -44,
-44, -44, -13
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@ -653,38 +637,38 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
2, 31, 8, 32, 33, 34, 35, 36, 41, 42,
43, 53, 44, 14, 22, 27, 15, 53, 28, 41,
42, 43, 3, 32, 33, 34, 35, 36, 10, 11,
12, 17, 19, 22, 40, 24, 38, 39, 57, 50,
58, 23, 26, 49, 52, 56, 59
41, 42, 43, 31, 32, 33, 34, 35, 53, 2,
27, 8, 14, 28, 53, 10, 11, 12, 15, 22,
36, 17, 19, 44, 3, 31, 32, 33, 34, 35,
41, 42, 43, 22, 24, 38, 40, 39, 57, 50,
23, 49, 52, 56, 59, 26, 0, 58
};
#define yypact_value_is_default(yystate) \
((yystate) == (-41))
((yystate) == (-44))
#define yytable_value_is_error(yytable_value) \
YYID (0)
static const yytype_uint8 yycheck[] =
static const yytype_int8 yycheck[] =
{
0, 11, 3, 13, 14, 15, 16, 17, 3, 4,
5, 51, 7, 6, 9, 3, 3, 57, 6, 3,
4, 5, 22, 13, 14, 15, 16, 17, 19, 20,
21, 23, 3, 9, 3, 18, 10, 18, 18, 12,
8, 18, 24, 39, 50, 52, 57
3, 4, 5, 7, 8, 9, 10, 11, 51, 0,
3, 3, 6, 6, 57, 12, 13, 14, 3, 22,
24, 16, 3, 26, 15, 7, 8, 9, 10, 11,
3, 4, 5, 22, 21, 23, 3, 21, 21, 25,
18, 39, 50, 52, 57, 24, -1, 27
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 29, 0, 22, 30, 31, 32, 33, 3, 35,
19, 20, 21, 36, 6, 3, 34, 23, 39, 3,
37, 38, 9, 40, 18, 41, 38, 3, 6, 42,
43, 11, 13, 14, 15, 16, 17, 44, 10, 18,
3, 3, 4, 5, 7, 40, 45, 46, 47, 42,
12, 48, 44, 45, 49, 50, 46, 18, 8, 50
0, 29, 0, 15, 30, 31, 32, 33, 3, 35,
12, 13, 14, 36, 6, 3, 34, 16, 39, 3,
37, 38, 22, 40, 21, 41, 38, 3, 6, 42,
43, 7, 8, 9, 10, 11, 24, 44, 23, 21,
3, 3, 4, 5, 26, 40, 45, 46, 47, 42,
25, 48, 44, 45, 49, 50, 46, 21, 27, 50
};
#define yyerrok (yyerrstatus = 0)
@ -1570,7 +1554,7 @@ yyreduce:
case 3:
/* Line 1806 of yacc.c */
#line 107 "config_parser.yy"
#line 100 "config_parser.yy"
{
context->SetResult(m_Objects);
}
@ -1579,7 +1563,7 @@ yyreduce:
case 7:
/* Line 1806 of yacc.c */
#line 119 "config_parser.yy"
#line 112 "config_parser.yy"
{
m_Abstract = false;
m_Local = false;
@ -1589,7 +1573,7 @@ yyreduce:
case 8:
/* Line 1806 of yacc.c */
#line 124 "config_parser.yy"
#line 117 "config_parser.yy"
{
m_Object = make_shared<DConfigObject>((yyvsp[(4) - (5)].text), (yyvsp[(5) - (5)].text), yylloc.first_line);
free((yyvsp[(4) - (5)].text));
@ -1600,7 +1584,7 @@ yyreduce:
case 9:
/* Line 1806 of yacc.c */
#line 130 "config_parser.yy"
#line 123 "config_parser.yy"
{
Object::Ptr exprl_object = *(yyvsp[(8) - (8)].variant);
delete (yyvsp[(8) - (8)].variant);
@ -1629,7 +1613,7 @@ yyreduce:
case 12:
/* Line 1806 of yacc.c */
#line 160 "config_parser.yy"
#line 153 "config_parser.yy"
{
m_Abstract = true;
}
@ -1638,7 +1622,7 @@ yyreduce:
case 13:
/* Line 1806 of yacc.c */
#line 164 "config_parser.yy"
#line 157 "config_parser.yy"
{
m_Local = true;
}
@ -1647,7 +1631,7 @@ yyreduce:
case 16:
/* Line 1806 of yacc.c */
#line 174 "config_parser.yy"
#line 167 "config_parser.yy"
{
m_Object->AddParent((yyvsp[(1) - (1)].text));
}
@ -1656,7 +1640,7 @@ yyreduce:
case 19:
/* Line 1806 of yacc.c */
#line 184 "config_parser.yy"
#line 177 "config_parser.yy"
{
m_ExpressionLists.push(make_shared<ExpressionList>());
}
@ -1665,7 +1649,7 @@ yyreduce:
case 20:
/* Line 1806 of yacc.c */
#line 189 "config_parser.yy"
#line 182 "config_parser.yy"
{
(yyval.variant) = new Variant(m_ExpressionLists.top());
m_ExpressionLists.pop();
@ -1675,7 +1659,7 @@ yyreduce:
case 24:
/* Line 1806 of yacc.c */
#line 201 "config_parser.yy"
#line 194 "config_parser.yy"
{
Expression expr((yyvsp[(1) - (3)].text), (yyvsp[(2) - (3)].op), *(yyvsp[(3) - (3)].variant), yylloc.first_line);
free((yyvsp[(1) - (3)].text));
@ -1688,7 +1672,7 @@ yyreduce:
case 25:
/* Line 1806 of yacc.c */
#line 209 "config_parser.yy"
#line 202 "config_parser.yy"
{
Expression subexpr((yyvsp[(3) - (6)].text), (yyvsp[(5) - (6)].op), *(yyvsp[(6) - (6)].variant), yylloc.first_line);
free((yyvsp[(3) - (6)].text));
@ -1706,7 +1690,7 @@ yyreduce:
case 26:
/* Line 1806 of yacc.c */
#line 222 "config_parser.yy"
#line 215 "config_parser.yy"
{
Expression expr((yyvsp[(1) - (1)].text), OperatorSet, (yyvsp[(1) - (1)].text), yylloc.first_line);
free((yyvsp[(1) - (1)].text));
@ -1718,7 +1702,7 @@ yyreduce:
case 31:
/* Line 1806 of yacc.c */
#line 235 "config_parser.yy"
#line 228 "config_parser.yy"
{
(yyval.op) = (yyvsp[(1) - (1)].op);
}
@ -1727,7 +1711,7 @@ yyreduce:
case 32:
/* Line 1806 of yacc.c */
#line 241 "config_parser.yy"
#line 234 "config_parser.yy"
{
(yyval.variant) = new Variant((yyvsp[(1) - (1)].text));
}
@ -1736,7 +1720,7 @@ yyreduce:
case 33:
/* Line 1806 of yacc.c */
#line 245 "config_parser.yy"
#line 238 "config_parser.yy"
{
(yyval.variant) = new Variant((yyvsp[(1) - (1)].num));
}
@ -1745,7 +1729,7 @@ yyreduce:
case 34:
/* Line 1806 of yacc.c */
#line 249 "config_parser.yy"
#line 242 "config_parser.yy"
{
(yyval.variant) = new Variant();
}
@ -1754,7 +1738,7 @@ yyreduce:
case 37:
/* Line 1806 of yacc.c */
#line 257 "config_parser.yy"
#line 250 "config_parser.yy"
{
(yyval.variant) = (yyvsp[(1) - (1)].variant);
}
@ -1763,7 +1747,7 @@ yyreduce:
case 38:
/* Line 1806 of yacc.c */
#line 263 "config_parser.yy"
#line 256 "config_parser.yy"
{
m_Array = make_shared<Dictionary>();
}
@ -1772,7 +1756,7 @@ yyreduce:
case 39:
/* Line 1806 of yacc.c */
#line 268 "config_parser.yy"
#line 261 "config_parser.yy"
{
(yyval.variant) = new Variant(m_Array);
m_Array.reset();
@ -1782,7 +1766,7 @@ yyreduce:
case 40:
/* Line 1806 of yacc.c */
#line 275 "config_parser.yy"
#line 268 "config_parser.yy"
{
m_Array->AddUnnamedProperty(*(yyvsp[(1) - (1)].variant));
delete (yyvsp[(1) - (1)].variant);
@ -1792,7 +1776,7 @@ yyreduce:
/* Line 1806 of yacc.c */
#line 1796 "config_parser.cc"
#line 1780 "config_parser.cc"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@ -2030,6 +2014,6 @@ yyreturn:
/* Line 2067 of yacc.c */
#line 285 "config_parser.yy"
#line 278 "config_parser.yy"

View File

@ -41,23 +41,16 @@
T_NUMBER = 259,
T_NULL = 260,
T_IDENTIFIER = 261,
T_OPEN_PARENTHESIS = 262,
T_CLOSE_PARENTHESIS = 263,
T_OPEN_BRACE = 264,
T_CLOSE_BRACE = 265,
T_OPEN_BRACKET = 266,
T_CLOSE_BRACKET = 267,
T_EQUAL = 268,
T_PLUS_EQUAL = 269,
T_MINUS_EQUAL = 270,
T_MULTIPLY_EQUAL = 271,
T_DIVIDE_EQUAL = 272,
T_COMMA = 273,
T_ABSTRACT = 274,
T_LOCAL = 275,
T_OBJECT = 276,
T_INCLUDE = 277,
T_INHERITS = 278
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_INHERITS = 271
};
#endif
/* Tokens. */
@ -65,23 +58,16 @@
#define T_NUMBER 259
#define T_NULL 260
#define T_IDENTIFIER 261
#define T_OPEN_PARENTHESIS 262
#define T_CLOSE_PARENTHESIS 263
#define T_OPEN_BRACE 264
#define T_CLOSE_BRACE 265
#define T_OPEN_BRACKET 266
#define T_CLOSE_BRACKET 267
#define T_EQUAL 268
#define T_PLUS_EQUAL 269
#define T_MINUS_EQUAL 270
#define T_MULTIPLY_EQUAL 271
#define T_DIVIDE_EQUAL 272
#define T_COMMA 273
#define T_ABSTRACT 274
#define T_LOCAL 275
#define T_OBJECT 276
#define T_INCLUDE 277
#define T_INHERITS 278
#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_INHERITS 271
@ -101,7 +87,7 @@ typedef union YYSTYPE
/* Line 2068 of yacc.c */
#line 105 "config_parser.h"
#line 91 "config_parser.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */

View File

@ -44,18 +44,11 @@ using namespace icinga;
%token <num> T_NUMBER
%token T_NULL
%token <text> T_IDENTIFIER
%token T_OPEN_PARENTHESIS
%token T_CLOSE_PARENTHESIS
%token T_OPEN_BRACE
%token T_CLOSE_BRACE
%token T_OPEN_BRACKET
%token T_CLOSE_BRACKET
%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
@ -167,7 +160,7 @@ attribute: T_ABSTRACT
;
inherits_list: inherits_item
| inherits_list T_COMMA inherits_item
| inherits_list ',' inherits_item
;
inherits_item: T_STRING
@ -180,12 +173,12 @@ inherits_specifier: /* empty */
| T_INHERITS inherits_list
;
expressionlist: T_OPEN_BRACE
expressionlist: '{'
{
m_ExpressionLists.push(make_shared<ExpressionList>());
}
expressions
T_CLOSE_BRACE
'}'
{
$$ = new Variant(m_ExpressionLists.top());
m_ExpressionLists.pop();
@ -194,7 +187,7 @@ expressionlist: T_OPEN_BRACE
expressions: /* empty */
| expression
| expression T_COMMA expressions
| expression ',' expressions
;
expression: T_IDENTIFIER operator value
@ -205,7 +198,7 @@ expression: T_IDENTIFIER operator value
m_ExpressionLists.top()->AddExpression(expr);
}
| T_IDENTIFIER T_OPEN_BRACKET T_STRING T_CLOSE_BRACKET operator value
| T_IDENTIFIER '[' T_STRING ']' operator value
{
Expression subexpr($3, $5, *$6, yylloc.first_line);
free($3);
@ -259,12 +252,12 @@ value: simplevalue
}
;
tuple: T_OPEN_PARENTHESIS
tuple: '('
{
m_Array = make_shared<Dictionary>();
}
tupleitems
T_CLOSE_PARENTHESIS
')'
{
$$ = new Variant(m_Array);
m_Array.reset();
@ -280,6 +273,6 @@ tupleitem: simplevalue
tupleitems:
/* empty */
| tupleitem
| tupleitem T_COMMA tupleitems
| tupleitem ',' tupleitems
;
%%

View File

@ -74,8 +74,9 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
break;
default:
assert(!"Not yet implemented.");
break;
//assert(!"Not yet implemented.");
}
dictionary->SetProperty(Key, newValue);