mirror of https://github.com/Icinga/icinga2.git
Config compiler: Added support for floating point numbers as well as negative numbers.
This commit is contained in:
parent
1405d1961a
commit
b2998f43c3
|
@ -379,15 +379,16 @@ struct yy_trans_info
|
||||||
flex_int32_t yy_verify;
|
flex_int32_t yy_verify;
|
||||||
flex_int32_t yy_nxt;
|
flex_int32_t yy_nxt;
|
||||||
};
|
};
|
||||||
static yyconst flex_int16_t yy_accept[70] =
|
static yyconst flex_int16_t yy_accept[72] =
|
||||||
{ 0,
|
{ 0,
|
||||||
0, 0, 0, 0, 23, 21, 20, 20, 21, 21,
|
0, 0, 0, 0, 23, 21, 20, 20, 21, 21,
|
||||||
21, 21, 21, 9, 10, 7, 7, 7, 7, 7,
|
21, 21, 21, 9, 10, 7, 7, 7, 7, 7,
|
||||||
7, 17, 18, 20, 0, 8, 13, 11, 12, 15,
|
7, 17, 18, 20, 0, 8, 13, 11, 9, 12,
|
||||||
0, 14, 9, 7, 7, 7, 7, 7, 7, 17,
|
15, 0, 14, 0, 7, 7, 7, 7, 7, 7,
|
||||||
16, 19, 7, 7, 7, 7, 7, 7, 7, 7,
|
17, 16, 19, 9, 7, 7, 7, 7, 7, 7,
|
||||||
7, 7, 6, 7, 7, 7, 7, 2, 7, 7,
|
7, 7, 7, 7, 6, 7, 7, 7, 7, 2,
|
||||||
7, 7, 3, 7, 4, 7, 1, 5, 0
|
7, 7, 7, 7, 3, 7, 4, 7, 1, 5,
|
||||||
|
0
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int32_t yy_ec[256] =
|
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, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 2, 1, 4, 1, 1, 1, 1, 1, 1,
|
1, 2, 1, 4, 1, 1, 1, 1, 1, 1,
|
||||||
1, 5, 6, 1, 7, 1, 8, 9, 9, 9,
|
1, 5, 6, 1, 7, 8, 9, 10, 10, 10,
|
||||||
9, 9, 9, 9, 9, 9, 9, 1, 1, 1,
|
10, 10, 10, 10, 10, 10, 10, 1, 1, 1,
|
||||||
10, 1, 1, 1, 11, 11, 11, 11, 11, 11,
|
11, 1, 1, 1, 12, 12, 12, 12, 12, 12,
|
||||||
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
|
||||||
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
|
||||||
1, 1, 1, 1, 11, 1, 12, 13, 14, 15,
|
1, 1, 1, 1, 12, 1, 13, 14, 15, 16,
|
||||||
|
|
||||||
16, 11, 11, 17, 18, 19, 11, 20, 11, 21,
|
17, 12, 12, 18, 19, 20, 12, 21, 12, 22,
|
||||||
22, 11, 11, 23, 24, 25, 26, 11, 11, 11,
|
23, 12, 12, 24, 25, 26, 27, 12, 12, 12,
|
||||||
11, 11, 1, 1, 1, 1, 1, 1, 1, 1,
|
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,
|
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,69 +423,71 @@ static yyconst flex_int32_t yy_ec[256] =
|
||||||
1, 1, 1, 1, 1
|
1, 1, 1, 1, 1
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int32_t yy_meta[27] =
|
static yyconst flex_int32_t yy_meta[28] =
|
||||||
{ 0,
|
{ 0,
|
||||||
1, 1, 2, 1, 3, 1, 4, 1, 4, 1,
|
1, 1, 2, 1, 3, 1, 4, 1, 1, 4,
|
||||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
1, 4, 4, 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[75] =
|
static yyconst flex_int16_t yy_base[77] =
|
||||||
{ 0,
|
{ 0,
|
||||||
0, 0, 87, 86, 90, 93, 25, 27, 85, 78,
|
0, 0, 93, 92, 96, 99, 26, 28, 91, 83,
|
||||||
77, 76, 26, 76, 93, 0, 71, 62, 60, 55,
|
82, 22, 29, 27, 99, 0, 78, 69, 67, 62,
|
||||||
67, 0, 71, 30, 74, 93, 93, 93, 93, 93,
|
74, 0, 78, 39, 82, 99, 99, 99, 35, 99,
|
||||||
0, 93, 68, 0, 52, 21, 61, 54, 54, 0,
|
99, 0, 99, 75, 0, 59, 21, 68, 61, 61,
|
||||||
93, 0, 47, 51, 54, 57, 48, 51, 43, 39,
|
0, 99, 0, 70, 53, 57, 60, 63, 54, 57,
|
||||||
41, 43, 0, 48, 49, 45, 41, 0, 33, 43,
|
49, 45, 47, 49, 0, 54, 55, 51, 47, 0,
|
||||||
40, 30, 0, 27, 0, 25, 0, 0, 93, 38,
|
39, 49, 46, 36, 0, 33, 0, 31, 0, 0,
|
||||||
42, 33, 46, 50
|
99, 45, 49, 40, 53, 57
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int16_t yy_def[75] =
|
static yyconst flex_int16_t yy_def[77] =
|
||||||
{ 0,
|
{ 0,
|
||||||
69, 1, 70, 70, 69, 69, 69, 69, 71, 69,
|
71, 1, 72, 72, 71, 71, 71, 71, 73, 71,
|
||||||
69, 69, 69, 69, 69, 72, 72, 72, 72, 72,
|
71, 71, 71, 71, 71, 74, 74, 74, 74, 74,
|
||||||
72, 73, 69, 69, 71, 69, 69, 69, 69, 69,
|
74, 75, 71, 71, 73, 71, 71, 71, 71, 71,
|
||||||
74, 69, 69, 72, 72, 72, 72, 72, 72, 73,
|
71, 76, 71, 71, 74, 74, 74, 74, 74, 74,
|
||||||
69, 74, 72, 72, 72, 72, 72, 72, 72, 72,
|
75, 71, 76, 71, 74, 74, 74, 74, 74, 74,
|
||||||
72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
|
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
||||||
72, 72, 72, 72, 72, 72, 72, 72, 0, 69,
|
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
||||||
69, 69, 69, 69
|
0, 71, 71, 71, 71, 71
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int16_t yy_nxt[120] =
|
static yyconst flex_int16_t yy_nxt[127] =
|
||||||
{ 0,
|
{ 0,
|
||||||
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
6, 7, 8, 9, 10, 11, 12, 6, 13, 14,
|
||||||
16, 17, 16, 16, 16, 16, 16, 18, 16, 19,
|
15, 16, 17, 16, 16, 16, 16, 16, 18, 16,
|
||||||
20, 21, 16, 16, 16, 16, 24, 24, 24, 24,
|
19, 20, 21, 16, 16, 16, 16, 24, 24, 24,
|
||||||
30, 24, 24, 31, 44, 32, 34, 45, 22, 22,
|
24, 29, 30, 31, 34, 46, 29, 32, 47, 33,
|
||||||
22, 22, 25, 25, 25, 25, 40, 40, 68, 40,
|
24, 24, 34, 35, 29, 22, 22, 22, 22, 25,
|
||||||
42, 67, 42, 42, 66, 65, 64, 63, 62, 61,
|
25, 25, 25, 41, 41, 70, 41, 43, 69, 43,
|
||||||
60, 59, 58, 57, 56, 55, 54, 53, 52, 51,
|
43, 68, 67, 66, 65, 64, 63, 62, 61, 60,
|
||||||
50, 49, 48, 47, 46, 43, 33, 26, 41, 39,
|
59, 58, 57, 56, 55, 54, 53, 52, 51, 44,
|
||||||
38, 37, 36, 35, 33, 29, 28, 27, 26, 69,
|
50, 49, 48, 45, 44, 26, 42, 40, 39, 38,
|
||||||
23, 23, 5, 69, 69, 69, 69, 69, 69, 69,
|
37, 36, 28, 27, 26, 71, 23, 23, 5, 71,
|
||||||
|
|
||||||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
|
71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
|
||||||
69, 69, 69, 69, 69, 69, 69, 69, 69
|
71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
|
||||||
|
71, 71, 71, 71, 71, 71
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int16_t yy_chk[120] =
|
static yyconst flex_int16_t yy_chk[127] =
|
||||||
{ 0,
|
{ 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, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 7, 7, 8, 8,
|
1, 1, 1, 1, 1, 1, 1, 7, 7, 8,
|
||||||
13, 24, 24, 13, 36, 13, 72, 36, 70, 70,
|
8, 12, 12, 13, 14, 37, 14, 13, 37, 13,
|
||||||
70, 70, 71, 71, 71, 71, 73, 73, 66, 73,
|
24, 24, 29, 74, 29, 72, 72, 72, 72, 73,
|
||||||
74, 64, 74, 74, 62, 61, 60, 59, 57, 56,
|
73, 73, 73, 75, 75, 68, 75, 76, 66, 76,
|
||||||
55, 54, 52, 51, 50, 49, 48, 47, 46, 45,
|
76, 64, 63, 62, 61, 59, 58, 57, 56, 54,
|
||||||
44, 43, 39, 38, 37, 35, 33, 25, 23, 21,
|
53, 52, 51, 50, 49, 48, 47, 46, 45, 44,
|
||||||
20, 19, 18, 17, 14, 12, 11, 10, 9, 5,
|
40, 39, 38, 36, 34, 25, 23, 21, 20, 19,
|
||||||
4, 3, 69, 69, 69, 69, 69, 69, 69, 69,
|
18, 17, 11, 10, 9, 5, 4, 3, 71, 71,
|
||||||
|
|
||||||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
|
71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
|
||||||
69, 69, 69, 69, 69, 69, 69, 69, 69
|
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. */
|
/* Table of booleans, true if rule could match eol. */
|
||||||
|
@ -543,7 +546,7 @@ do { \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define YY_NO_UNISTD_H 1
|
#define YY_NO_UNISTD_H 1
|
||||||
|
|
||||||
#line 547 "config_lexer.cc"
|
#line 550 "config_lexer.cc"
|
||||||
|
|
||||||
#define INITIAL 0
|
#define INITIAL 0
|
||||||
#define IN_C_COMMENT 1
|
#define IN_C_COMMENT 1
|
||||||
|
@ -792,7 +795,7 @@ YY_DECL
|
||||||
|
|
||||||
#line 49 "config_lexer.ll"
|
#line 49 "config_lexer.ll"
|
||||||
|
|
||||||
#line 796 "config_lexer.cc"
|
#line 799 "config_lexer.cc"
|
||||||
|
|
||||||
yylval = yylval_param;
|
yylval = yylval_param;
|
||||||
|
|
||||||
|
@ -849,13 +852,13 @@ yy_match:
|
||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 70 )
|
if ( yy_current_state >= 72 )
|
||||||
yy_c = yy_meta[(unsigned int) yy_c];
|
yy_c = yy_meta[(unsigned int) yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||||
++yy_cp;
|
++yy_cp;
|
||||||
}
|
}
|
||||||
while ( yy_current_state != 69 );
|
while ( yy_current_state != 71 );
|
||||||
yy_cp = yyg->yy_last_accepting_cpos;
|
yy_cp = yyg->yy_last_accepting_cpos;
|
||||||
yy_current_state = yyg->yy_last_accepting_state;
|
yy_current_state = yyg->yy_last_accepting_state;
|
||||||
|
|
||||||
|
@ -931,7 +934,7 @@ YY_RULE_SETUP
|
||||||
case 9:
|
case 9:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 58 "config_lexer.ll"
|
#line 58 "config_lexer.ll"
|
||||||
{ yylval->num = atoi(yytext); return T_NUMBER; }
|
{ yylval->num = strtod(yytext, NULL); return T_NUMBER; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 10:
|
case 10:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
|
@ -1004,7 +1007,7 @@ YY_RULE_SETUP
|
||||||
#line 79 "config_lexer.ll"
|
#line 79 "config_lexer.ll"
|
||||||
ECHO;
|
ECHO;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
#line 1008 "config_lexer.cc"
|
#line 1011 "config_lexer.cc"
|
||||||
case YY_STATE_EOF(INITIAL):
|
case YY_STATE_EOF(INITIAL):
|
||||||
case YY_STATE_EOF(IN_C_COMMENT):
|
case YY_STATE_EOF(IN_C_COMMENT):
|
||||||
yyterminate();
|
yyterminate();
|
||||||
|
@ -1300,7 +1303,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 70 )
|
if ( yy_current_state >= 72 )
|
||||||
yy_c = yy_meta[(unsigned int) yy_c];
|
yy_c = yy_meta[(unsigned int) yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||||
|
@ -1329,11 +1332,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 70 )
|
if ( yy_current_state >= 72 )
|
||||||
yy_c = yy_meta[(unsigned int) yy_c];
|
yy_c = yy_meta[(unsigned int) yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||||
yy_is_jam = (yy_current_state == 69);
|
yy_is_jam = (yy_current_state == 71);
|
||||||
|
|
||||||
return yy_is_jam ? 0 : yy_current_state;
|
return yy_is_jam ? 0 : yy_current_state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ inherits return T_INHERITS;
|
||||||
null return T_NULL;
|
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; }
|
\"[^\"]*\" { yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING; }
|
||||||
[0-9]+ { yylval->num = atoi(yytext); return T_NUMBER; }
|
-?[0-9]+(\.[0-9]+)? { yylval->num = strtod(yytext, NULL); return T_NUMBER; }
|
||||||
= { yylval->op = OperatorSet; return T_EQUAL; }
|
= { yylval->op = OperatorSet; return T_EQUAL; }
|
||||||
\+= { yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
|
\+= { yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
|
||||||
-= { yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
|
-= { yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
|
||||||
|
|
|
@ -172,7 +172,7 @@ typedef union YYSTYPE
|
||||||
#line 38 "config_parser.yy"
|
#line 38 "config_parser.yy"
|
||||||
|
|
||||||
char *text;
|
char *text;
|
||||||
int num;
|
double num;
|
||||||
icinga::Variant *variant;
|
icinga::Variant *variant;
|
||||||
icinga::ExpressionOperator op;
|
icinga::ExpressionOperator op;
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ typedef union YYSTYPE
|
||||||
#line 38 "config_parser.yy"
|
#line 38 "config_parser.yy"
|
||||||
|
|
||||||
char *text;
|
char *text;
|
||||||
int num;
|
double num;
|
||||||
icinga::Variant *variant;
|
icinga::Variant *variant;
|
||||||
icinga::ExpressionOperator op;
|
icinga::ExpressionOperator op;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ using namespace icinga;
|
||||||
|
|
||||||
%union {
|
%union {
|
||||||
char *text;
|
char *text;
|
||||||
int num;
|
double num;
|
||||||
icinga::Variant *variant;
|
icinga::Variant *variant;
|
||||||
icinga::ExpressionOperator op;
|
icinga::ExpressionOperator op;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue