]> granicus.if.org Git - icinga2/commitdiff
Config: Implement true/false as aliases for 1/0
authorGunnar Beutner <gunnar.beutner@netways.de>
Thu, 24 Jan 2013 09:08:03 +0000 (10:08 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Thu, 24 Jan 2013 09:08:03 +0000 (10:08 +0100)
Fixes #3551

lib/config/config_lexer.cc
lib/config/config_lexer.ll

index 46f3d18bf51b24203a7d20d6ceebb8724ac669a2..dc678c69db3126a7f539a2d3a592bab168652790 100644 (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 26
-#define YY_END_OF_BUFFER 27
+#define YY_NUM_RULES 28
+#define YY_END_OF_BUFFER 29
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -379,17 +379,19 @@ struct yy_trans_info
        flex_int32_t yy_verify;
        flex_int32_t yy_nxt;
        };
-static yyconst flex_int16_t yy_accept[85] =
+static yyconst flex_int16_t yy_accept[94] =
     {   0,
-        0,    0,    0,    0,   27,   25,   24,   24,   25,   25,
-       25,   25,   25,   25,   13,   14,    8,    8,    8,    8,
-        8,    8,   21,   22,   24,    0,    9,    0,    0,   17,
-       15,   13,   16,   19,    0,   18,    0,   10,   11,   12,
-        8,    8,    8,    8,    8,    8,   21,   20,    0,    0,
-       23,   13,    8,    8,    8,    8,    8,    0,    0,    8,
-        8,    8,    7,    8,    0,    0,    8,    8,    2,    8,
-        0,    0,    8,    8,    3,    0,    0,    8,    8,    4,
-        5,    1,    6,    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
+
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -405,9 +407,9 @@ static yyconst flex_int32_t yy_ec[256] =
        13,   13,   13,   13,   13,   13,   13,   13,   13,   13,
         1,    1,    1,    1,   13,    1,   14,   15,   16,   17,
 
-       18,   13,   13,   19,   20,   21,   13,   22,   23,   24,
-       25,   13,   13,   26,   27,   28,   29,   13,   13,   13,
-       30,   13,    1,    1,    1,    1,    1,    1,    1,    1,
+       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,
         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,
@@ -424,84 +426,91 @@ 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[32] =
     {   0,
         1,    1,    2,    1,    1,    3,    1,    4,    1,    1,
         4,    1,    4,    4,    4,    4,    4,    4,    4,    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[90] =
+static yyconst flex_int16_t yy_base[99] =
     {   0,
-        0,    0,  108,  107,  112,  115,   29,   31,  107,   15,
-       98,   97,   27,   30,   34,  115,    0,   93,   83,   81,
-       76,   89,    0,   93,   44,   98,  115,   77,   80,  115,
-      115,    0,  115,  115,    0,  115,   88,  115,  115,  115,
-        0,   71,   78,   80,   73,   73,    0,  115,   77,   77,
-        0,   33,   63,   72,   75,   66,   69,   64,   59,   58,
-       57,   60,    0,   65,   51,   65,   64,   55,    0,   44,
-       42,   32,   39,   26,    0,   33,   20,   21,   21,  115,
-      115,    0,    0,  115,   61,   65,   37,   69,   73
+        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
+
     } ;
 
-static yyconst flex_int16_t yy_def[90] =
+static yyconst flex_int16_t yy_def[99] =
     {   0,
-       84,    1,   85,   85,   84,   84,   84,   84,   86,   84,
-       84,   84,   84,   84,   84,   84,   87,   87,   87,   87,
-       87,   87,   88,   84,   84,   86,   84,   84,   84,   84,
-       84,   15,   84,   84,   89,   84,   84,   84,   84,   84,
-       87,   87,   87,   87,   87,   87,   88,   84,   84,   84,
-       89,   84,   87,   87,   87,   87,   87,   84,   84,   87,
-       87,   87,   87,   87,   84,   84,   87,   87,   87,   87,
-       84,   84,   87,   87,   87,   84,   84,   87,   87,   84,
-       84,   87,   87,    0,   84,   84,   84,   84,   84
+       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
+
     } ;
 
-static yyconst flex_int16_t yy_nxt[146] =
+static yyconst flex_int16_t yy_nxt[155] =
     {   0,
         6,    7,    8,    9,   10,   11,   12,   13,    6,   14,
-       15,   16,   17,   18,   17,   17,   17,   17,   17,   19,
-       17,   20,   17,   21,   22,   17,   17,   17,   17,   17,
-       25,   25,   25,   25,   28,   34,   29,   32,   33,   35,
-       41,   36,   37,   52,   32,   25,   25,   83,   82,   81,
-       80,   38,   38,   79,   78,   39,   39,   77,   76,   40,
-       40,   23,   23,   23,   23,   26,   26,   26,   26,   47,
-       47,   75,   47,   51,   74,   51,   51,   73,   72,   71,
+       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,
-       60,   59,   58,   57,   56,   55,   54,   53,   52,   50,
 
-       49,   27,   48,   46,   45,   44,   43,   42,   31,   30,
-       27,   84,   24,   24,    5,   84,   84,   84,   84,   84,
-       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,
-       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,
-       84,   84,   84,   84,   84
+       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
     } ;
 
-static yyconst flex_int16_t yy_chk[146] =
+static yyconst flex_int16_t yy_chk[155] =
     {   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,    8,    8,   10,   14,   10,   13,   13,   14,
-       87,   14,   15,   52,   15,   25,   25,   79,   78,   77,
-       76,   52,   15,   74,   73,   52,   15,   72,   71,   52,
-       15,   85,   85,   85,   85,   86,   86,   86,   86,   88,
-       88,   70,   88,   89,   68,   89,   89,   67,   66,   65,
-       64,   62,   61,   60,   59,   58,   57,   56,   55,   54,
-       53,   50,   49,   46,   45,   44,   43,   42,   37,   29,
-
-       28,   26,   24,   22,   21,   20,   19,   18,   12,   11,
-        9,    5,    4,    3,   84,   84,   84,   84,   84,   84,
-       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,
-       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,
-       84,   84,   84,   84,   84
+        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,
+
+       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
     } ;
 
 /* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[27] =
+static yyconst flex_int32_t yy_rule_can_match_eol[29] =
     {   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, 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.
@@ -553,7 +562,7 @@ do {                                                        \
 } while (0)
 #define YY_NO_UNISTD_H 1
 
-#line 557 "config_lexer.cc"
+#line 566 "config_lexer.cc"
 
 #define INITIAL 0
 #define IN_C_COMMENT 1
@@ -802,7 +811,7 @@ YY_DECL
 
 #line 49 "config_lexer.ll"
 
-#line 806 "config_lexer.cc"
+#line 815 "config_lexer.cc"
 
     yylval = yylval_param;
 
@@ -859,13 +868,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 >= 85 )
+                               if ( yy_current_state >= 94 )
                                        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 != 84 );
+               while ( yy_current_state != 93 );
                yy_cp = yyg->yy_last_accepting_cpos;
                yy_current_state = yyg->yy_last_accepting_state;
 
@@ -935,106 +944,116 @@ return T_NULL;
 case 8:
 YY_RULE_SETUP
 #line 57 "config_lexer.ll"
-{ yylval->text = strdup(yytext); return T_IDENTIFIER; }
+{ yylval->num = 1; return T_NUMBER; }
        YY_BREAK
 case 9:
-/* rule 9 can match eol */
 YY_RULE_SETUP
 #line 58 "config_lexer.ll"
-{ yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING; }
+{ yylval->num = 0; return T_NUMBER; }
        YY_BREAK
 case 10:
 YY_RULE_SETUP
 #line 59 "config_lexer.ll"
-{ yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; }
+{ yylval->text = strdup(yytext); return T_IDENTIFIER; }
        YY_BREAK
 case 11:
+/* rule 11 can match eol */
 YY_RULE_SETUP
 #line 60 "config_lexer.ll"
-{ yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; }
+{ yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING; }
        YY_BREAK
 case 12:
 YY_RULE_SETUP
 #line 61 "config_lexer.ll"
-{ yylval->num = strtod(yytext, NULL); return T_NUMBER; }
+{ yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; }
        YY_BREAK
 case 13:
 YY_RULE_SETUP
 #line 62 "config_lexer.ll"
-{ yylval->num = strtod(yytext, NULL); return T_NUMBER; }
+{ yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; }
        YY_BREAK
 case 14:
 YY_RULE_SETUP
 #line 63 "config_lexer.ll"
-{ yylval->op = OperatorSet; return T_EQUAL; }
+{ yylval->num = strtod(yytext, NULL); return T_NUMBER; }
        YY_BREAK
 case 15:
 YY_RULE_SETUP
 #line 64 "config_lexer.ll"
-{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
+{ yylval->num = strtod(yytext, NULL); return T_NUMBER; }
        YY_BREAK
 case 16:
 YY_RULE_SETUP
 #line 65 "config_lexer.ll"
-{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
+{ yylval->op = OperatorSet; return T_EQUAL; }
        YY_BREAK
 case 17:
 YY_RULE_SETUP
 #line 66 "config_lexer.ll"
-{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
+{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
        YY_BREAK
 case 18:
 YY_RULE_SETUP
 #line 67 "config_lexer.ll"
+{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
+       YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 68 "config_lexer.ll"
+{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
+       YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 69 "config_lexer.ll"
 { yylval->op = OperatorDivide; return T_DIVIDE_EQUAL; }
        YY_BREAK
 
-case 19:
+case 21:
 YY_RULE_SETUP
-#line 70 "config_lexer.ll"
+#line 72 "config_lexer.ll"
 BEGIN(IN_C_COMMENT);
        YY_BREAK
 
 
-case 20:
+case 22:
 YY_RULE_SETUP
-#line 74 "config_lexer.ll"
+#line 76 "config_lexer.ll"
 BEGIN(INITIAL);
        YY_BREAK
-case 21:
-/* rule 21 can match eol */
+case 23:
+/* rule 23 can match eol */
 YY_RULE_SETUP
-#line 75 "config_lexer.ll"
+#line 77 "config_lexer.ll"
 /* ignore comment */
        YY_BREAK
-case 22:
+case 24:
 YY_RULE_SETUP
-#line 76 "config_lexer.ll"
+#line 78 "config_lexer.ll"
 /* ignore star */
        YY_BREAK
 
-case 23:
+case 25:
 YY_RULE_SETUP
-#line 79 "config_lexer.ll"
+#line 81 "config_lexer.ll"
 /* ignore C++-style comments */
        YY_BREAK
-case 24:
-/* rule 24 can match eol */
+case 26:
+/* rule 26 can match eol */
 YY_RULE_SETUP
-#line 80 "config_lexer.ll"
+#line 82 "config_lexer.ll"
 /* ignore whitespace */
        YY_BREAK
-case 25:
+case 27:
 YY_RULE_SETUP
-#line 82 "config_lexer.ll"
+#line 84 "config_lexer.ll"
 return yytext[0];
        YY_BREAK
-case 26:
+case 28:
 YY_RULE_SETUP
-#line 83 "config_lexer.ll"
+#line 85 "config_lexer.ll"
 ECHO;
        YY_BREAK
-#line 1038 "config_lexer.cc"
+#line 1057 "config_lexer.cc"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(IN_C_COMMENT):
        yyterminate();
@@ -1330,7 +1349,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 >= 85 )
+                       if ( yy_current_state >= 94 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1359,11 +1378,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 >= 85 )
+               if ( yy_current_state >= 94 )
                        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 == 84);
+       yy_is_jam = (yy_current_state == 93);
 
        return yy_is_jam ? 0 : yy_current_state;
 }
@@ -2222,7 +2241,7 @@ void yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 83 "config_lexer.ll"
+#line 85 "config_lexer.ll"
 
 
 
index 468da1994dcc28628becfca68ac967a318f30d05..34260e3f9e99161836561061322620ea22276552 100644 (file)
@@ -54,6 +54,8 @@ object                                return T_OBJECT;
 #library                       return T_LIBRARY;
 inherits                       return T_INHERITS;
 null                           return T_NULL;
+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; }
 -?[0-9]+(\.[0-9]+)?h           { yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; }