diff --git a/lib/config/config_lexer.cc b/lib/config/config_lexer.cc index e5c273ed5..d8921b2bb 100644 --- a/lib/config/config_lexer.cc +++ b/lib/config/config_lexer.cc @@ -1,5 +1,5 @@ -#line 3 "config_lexer.cc" +#line 3 "../../../lib/config/config_lexer.cc" #define YY_INT_ALIGNED short int @@ -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 56 -#define YY_END_OF_BUFFER 57 +#define YY_NUM_RULES 57 +#define YY_END_OF_BUFFER 58 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -379,28 +379,30 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[191] = +static yyconst flex_int16_t yy_accept[194] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 57, 55, - 21, 21, 1, 55, 43, 55, 55, 55, 49, 55, - 50, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 55, 18, 19, 12, 3, 2, 56, 15, - 15, 0, 0, 0, 43, 53, 51, 49, 52, 16, - 20, 54, 0, 46, 47, 48, 0, 44, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 0, 17, 12, 11, 4, 5, - 9, 10, 6, 8, 7, 0, 0, 0, 0, 20, - 49, 45, 43, 28, 43, 43, 43, 43, 43, 43, + 0, 0, 0, 0, 0, 0, 0, 0, 58, 56, + 21, 21, 1, 56, 44, 56, 56, 56, 50, 56, + 51, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 56, 18, 19, 12, 3, 2, 57, 15, + 15, 0, 0, 0, 44, 54, 52, 50, 53, 16, + 20, 55, 0, 47, 48, 49, 0, 45, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 0, 17, 12, 11, 4, + 5, 9, 10, 6, 8, 7, 0, 0, 0, 0, + 20, 50, 46, 44, 28, 44, 44, 44, 44, 44, + + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 13, 4, 5, 14, 0, 0, 0, 44, + 44, 44, 44, 44, 44, 44, 44, 29, 40, 44, + 44, 44, 44, 44, 44, 42, 22, 4, 0, 0, + 0, 44, 24, 44, 43, 44, 44, 44, 34, 44, + 44, 44, 44, 44, 44, 0, 0, 0, 44, 44, + 44, 44, 44, 25, 35, 44, 27, 26, 44, 0, + 0, 0, 44, 44, 37, 44, 38, 41, 44, 0, + 31, 0, 33, 44, 39, 36, 0, 0, 44, 32, + 30, 23, 0 - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 13, 4, 5, 14, 0, 0, 0, 43, 43, 43, - 43, 43, 43, 43, 43, 39, 43, 43, 43, 43, - 43, 43, 41, 22, 4, 0, 0, 0, 43, 24, - 43, 42, 43, 43, 43, 33, 43, 43, 43, 43, - 43, 43, 0, 0, 0, 43, 43, 43, 43, 43, - 25, 34, 43, 27, 26, 43, 0, 0, 0, 43, - 43, 36, 43, 37, 40, 43, 0, 30, 0, 32, - 43, 38, 35, 0, 0, 43, 31, 29, 23, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -444,156 +446,162 @@ static yyconst flex_int32_t yy_meta[43] = 1, 1 } ; -static yyconst flex_int16_t yy_base[199] = +static yyconst flex_int16_t yy_base[202] = { 0, - 0, 0, 340, 339, 40, 42, 302, 301, 342, 347, - 347, 347, 347, 28, 326, 325, 37, 44, 44, 323, - 347, 323, 42, 49, 46, 51, 54, 53, 63, 56, - 64, 69, 296, 347, 326, 0, 347, 347, 99, 347, - 293, 297, 310, 313, 316, 347, 347, 86, 347, 347, - 0, 347, 76, 347, 294, 347, 313, 347, 36, 74, - 78, 75, 79, 100, 85, 103, 102, 92, 110, 84, - 112, 113, 91, 118, 287, 347, 0, 347, 126, 128, - 347, 347, 347, 347, 347, 285, 289, 291, 295, 0, - 130, 347, 120, 308, 129, 131, 134, 135, 138, 137, + 0, 0, 346, 345, 40, 42, 308, 307, 348, 353, + 353, 353, 353, 28, 332, 331, 37, 44, 44, 329, + 353, 329, 42, 49, 46, 51, 54, 53, 63, 56, + 64, 69, 302, 353, 332, 0, 353, 353, 99, 353, + 299, 303, 316, 319, 322, 353, 353, 86, 353, 353, + 0, 353, 76, 353, 300, 353, 319, 353, 78, 75, + 85, 81, 74, 92, 79, 106, 102, 109, 113, 90, + 114, 91, 116, 120, 122, 293, 353, 0, 353, 131, + 133, 353, 353, 353, 353, 353, 291, 295, 297, 301, + 0, 136, 353, 134, 314, 135, 136, 125, 138, 137, - 139, 140, 147, 148, 144, 150, 158, 159, 160, 161, - 347, 166, 175, 347, 287, 283, 293, 165, 167, 174, - 173, 175, 176, 178, 179, 304, 180, 183, 187, 190, - 184, 191, 303, 302, 205, 289, 288, 292, 203, 298, - 195, 297, 197, 206, 208, 296, 209, 210, 211, 213, - 214, 216, 290, 272, 281, 217, 219, 222, 221, 225, - 284, 265, 226, 264, 263, 227, 239, 253, 238, 231, - 234, 258, 236, 256, 255, 237, 232, 347, 235, 251, - 239, 248, 247, 238, 224, 241, 347, 347, 242, 347, - 281, 285, 289, 98, 293, 297, 301, 305 + 141, 144, 142, 149, 154, 160, 153, 155, 162, 164, + 165, 170, 353, 170, 175, 353, 293, 289, 299, 176, + 177, 179, 180, 181, 183, 185, 184, 310, 309, 186, + 187, 195, 197, 190, 199, 308, 307, 212, 294, 293, + 297, 210, 303, 200, 302, 205, 211, 215, 299, 216, + 218, 220, 219, 221, 222, 287, 271, 268, 227, 225, + 229, 228, 230, 271, 270, 232, 269, 268, 234, 244, + 258, 242, 238, 243, 262, 242, 261, 259, 244, 236, + 353, 240, 254, 245, 253, 251, 241, 172, 248, 353, + 353, 93, 353, 288, 292, 296, 47, 300, 304, 308, + 312 } ; -static yyconst flex_int16_t yy_def[199] = +static yyconst flex_int16_t yy_def[202] = { 0, - 190, 1, 191, 191, 192, 192, 193, 193, 190, 190, - 190, 190, 190, 190, 194, 190, 190, 190, 190, 195, - 190, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 190, 190, 190, 196, 190, 190, 197, 190, - 190, 190, 190, 190, 194, 190, 190, 190, 190, 190, - 198, 190, 190, 190, 190, 190, 195, 190, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 190, 190, 196, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 198, - 190, 190, 194, 194, 194, 194, 194, 194, 194, 194, + 193, 1, 194, 194, 195, 195, 196, 196, 193, 193, + 193, 193, 193, 193, 197, 193, 193, 193, 193, 198, + 193, 197, 197, 197, 197, 197, 197, 197, 197, 197, + 197, 197, 193, 193, 193, 199, 193, 193, 200, 193, + 193, 193, 193, 193, 197, 193, 193, 193, 193, 193, + 201, 193, 193, 193, 193, 193, 198, 193, 197, 197, + 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, + 197, 197, 197, 197, 197, 193, 193, 199, 193, 193, + 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, + 201, 193, 193, 197, 197, 197, 197, 197, 197, 197, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 190, 190, 190, 190, 190, 190, 190, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 190, 190, 190, 190, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 190, 190, 190, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 190, 190, 190, 194, - 194, 194, 194, 194, 194, 194, 190, 190, 190, 194, - 194, 194, 194, 190, 190, 194, 190, 190, 194, 0, - 190, 190, 190, 190, 190, 190, 190, 190 + 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, + 197, 197, 193, 193, 193, 193, 193, 193, 193, 197, + 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, + 197, 197, 197, 197, 197, 197, 197, 193, 193, 193, + 193, 197, 197, 197, 197, 197, 197, 197, 197, 197, + 197, 197, 197, 197, 197, 193, 193, 193, 197, 197, + 197, 197, 197, 197, 197, 197, 197, 197, 197, 193, + 193, 193, 197, 197, 197, 197, 197, 197, 197, 193, + 193, 193, 197, 197, 197, 197, 193, 193, 197, 193, + 193, 197, 0, 193, 193, 193, 193, 193, 193, 193, + 193 } ; -static yyconst flex_int16_t yy_nxt[390] = +static yyconst flex_int16_t yy_nxt[396] = { 0, 10, 11, 12, 13, 14, 15, 16, 17, 10, 18, 19, 19, 10, 20, 21, 10, 22, 10, 23, 22, 22, 24, 22, 25, 22, 22, 26, 22, 27, 22, 28, 29, 30, 22, 22, 31, 32, 22, 22, 22, 33, 10, 37, 38, 37, 38, 42, 48, 48, 50, - 190, 49, 53, 51, 48, 48, 190, 39, 52, 39, - 190, 59, 43, 190, 63, 190, 44, 190, 190, 54, - 190, 93, 60, 55, 69, 62, 61, 190, 190, 56, - 65, 64, 68, 190, 70, 66, 91, 91, 190, 190, - 67, 72, 190, 190, 53, 96, 48, 48, 190, 190, + 45, 49, 53, 51, 48, 48, 193, 39, 52, 39, + 193, 59, 43, 193, 63, 193, 44, 193, 193, 54, + 193, 67, 60, 55, 70, 62, 61, 193, 193, 56, + 65, 64, 69, 193, 71, 66, 92, 92, 193, 193, + 68, 73, 193, 193, 53, 193, 48, 48, 101, 193, - 71, 45, 106, 73, 100, 190, 190, 97, 74, 79, - 80, 54, 95, 94, 190, 55, 190, 190, 81, 104, - 98, 56, 82, 101, 190, 99, 190, 190, 109, 83, - 102, 103, 190, 84, 190, 85, 112, 113, 113, 113, - 91, 91, 108, 190, 105, 190, 107, 119, 190, 190, - 110, 190, 190, 190, 190, 54, 118, 125, 190, 55, - 123, 190, 190, 122, 190, 56, 127, 120, 126, 121, - 128, 124, 190, 190, 190, 190, 135, 113, 130, 190, - 129, 190, 133, 134, 131, 113, 113, 190, 190, 190, - 190, 132, 190, 190, 190, 142, 145, 190, 190, 139, + 72, 97, 98, 74, 193, 193, 193, 193, 75, 80, + 81, 54, 99, 94, 95, 55, 193, 100, 82, 96, + 193, 56, 83, 193, 107, 109, 102, 193, 193, 84, + 193, 103, 108, 85, 193, 86, 193, 104, 105, 193, + 106, 114, 115, 115, 115, 110, 92, 92, 193, 193, + 193, 193, 193, 121, 112, 193, 193, 111, 193, 125, + 123, 54, 127, 193, 128, 55, 124, 193, 193, 193, + 120, 56, 122, 130, 193, 126, 193, 129, 193, 193, + 138, 115, 131, 133, 193, 115, 115, 136, 134, 132, + 193, 193, 137, 193, 193, 193, 135, 193, 193, 193, - 141, 190, 147, 148, 190, 190, 140, 146, 150, 190, - 144, 190, 143, 149, 151, 113, 113, 190, 158, 152, - 190, 156, 190, 190, 190, 190, 157, 190, 190, 163, - 190, 190, 159, 190, 166, 190, 190, 170, 165, 190, - 190, 190, 160, 161, 172, 190, 162, 164, 190, 171, - 190, 190, 181, 190, 175, 190, 190, 173, 188, 183, - 187, 190, 190, 176, 174, 190, 185, 180, 184, 190, - 190, 182, 190, 186, 179, 178, 177, 190, 190, 190, - 189, 34, 34, 34, 34, 36, 36, 36, 36, 40, - 40, 40, 40, 57, 57, 57, 57, 77, 190, 169, + 193, 193, 145, 148, 193, 144, 191, 151, 150, 193, + 142, 193, 149, 193, 193, 153, 143, 147, 146, 193, + 154, 152, 115, 115, 193, 193, 161, 155, 159, 193, + 193, 160, 193, 193, 193, 193, 193, 162, 166, 193, + 169, 193, 193, 193, 193, 168, 193, 173, 193, 163, + 164, 175, 193, 167, 165, 174, 193, 193, 193, 193, + 178, 184, 193, 190, 176, 193, 186, 193, 193, 177, + 179, 188, 187, 193, 183, 193, 193, 185, 182, 189, + 181, 180, 193, 193, 193, 193, 172, 192, 34, 34, + 34, 34, 36, 36, 36, 36, 40, 40, 40, 40, + + 57, 57, 57, 57, 78, 171, 170, 78, 79, 79, + 79, 79, 91, 193, 91, 91, 193, 193, 158, 157, + 156, 193, 193, 193, 193, 141, 140, 139, 193, 119, + 118, 117, 116, 113, 58, 93, 193, 90, 89, 88, + 87, 77, 76, 193, 58, 47, 46, 193, 41, 41, + 35, 35, 9, 193, 193, 193, 193, 193, 193, 193, + 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, + 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, + 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, + 193, 193, 193, 193, 193 - 77, 78, 78, 78, 78, 90, 168, 90, 90, 167, - 190, 190, 190, 155, 154, 153, 190, 190, 190, 138, - 137, 136, 190, 117, 116, 115, 114, 111, 58, 92, - 190, 89, 88, 87, 86, 76, 75, 190, 58, 47, - 46, 190, 41, 41, 35, 35, 9, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190 } ; -static yyconst flex_int16_t yy_chk[390] = +static yyconst flex_int16_t yy_chk[396] = { 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, 5, 5, 6, 6, 14, 17, 17, 18, - 59, 17, 19, 18, 19, 19, 23, 5, 18, 6, + 197, 17, 19, 18, 19, 19, 23, 5, 18, 6, 25, 23, 14, 24, 25, 26, 14, 28, 27, 19, - 30, 59, 23, 19, 30, 24, 23, 29, 31, 19, - 27, 26, 29, 32, 31, 27, 53, 53, 60, 62, - 28, 32, 61, 63, 48, 62, 48, 48, 70, 65, + 30, 28, 23, 19, 30, 24, 23, 29, 31, 19, + 27, 26, 29, 32, 31, 27, 53, 53, 63, 60, + 28, 32, 59, 65, 48, 62, 48, 48, 65, 61, - 31, 194, 70, 32, 65, 73, 68, 63, 32, 39, - 39, 48, 61, 60, 64, 48, 67, 66, 39, 68, - 64, 48, 39, 66, 69, 64, 71, 72, 73, 39, - 67, 67, 74, 39, 93, 39, 79, 79, 80, 80, - 91, 91, 72, 95, 69, 96, 71, 95, 97, 98, - 74, 100, 99, 101, 102, 91, 93, 101, 105, 91, - 99, 103, 104, 98, 106, 91, 103, 96, 102, 97, - 104, 100, 107, 108, 109, 110, 112, 112, 106, 118, - 105, 119, 109, 110, 107, 113, 113, 121, 120, 122, - 123, 108, 124, 125, 127, 121, 124, 128, 131, 118, + 31, 62, 63, 32, 70, 72, 64, 192, 32, 39, + 39, 48, 64, 59, 60, 48, 67, 64, 39, 61, + 66, 48, 39, 68, 70, 72, 66, 69, 71, 39, + 73, 67, 71, 39, 74, 39, 75, 68, 68, 98, + 69, 80, 80, 81, 81, 73, 92, 92, 94, 96, + 97, 100, 99, 96, 75, 101, 103, 74, 102, 100, + 98, 92, 102, 104, 103, 92, 99, 107, 105, 108, + 94, 92, 97, 105, 106, 101, 109, 104, 110, 111, + 114, 114, 106, 108, 112, 115, 115, 111, 109, 107, + 120, 121, 112, 122, 123, 124, 110, 125, 127, 126, - 120, 129, 127, 128, 130, 132, 119, 125, 130, 141, - 123, 143, 122, 129, 131, 135, 135, 139, 143, 132, - 144, 139, 145, 147, 148, 149, 141, 150, 151, 149, - 152, 156, 144, 157, 152, 159, 158, 156, 151, 160, - 163, 166, 145, 147, 158, 170, 148, 150, 171, 157, - 173, 176, 171, 181, 163, 186, 189, 159, 185, 176, - 184, 183, 182, 166, 160, 180, 179, 170, 177, 175, - 174, 173, 172, 181, 169, 168, 167, 165, 164, 162, - 186, 191, 191, 191, 191, 192, 192, 192, 192, 193, - 193, 193, 193, 195, 195, 195, 195, 196, 161, 155, + 130, 131, 123, 126, 134, 122, 188, 131, 130, 132, + 120, 133, 127, 135, 144, 133, 121, 125, 124, 146, + 134, 132, 138, 138, 142, 147, 146, 135, 142, 148, + 150, 144, 151, 153, 152, 154, 155, 147, 152, 160, + 155, 159, 162, 161, 163, 154, 166, 159, 169, 148, + 150, 161, 173, 153, 151, 160, 176, 174, 179, 184, + 166, 174, 189, 187, 162, 186, 179, 185, 183, 163, + 169, 182, 180, 178, 173, 177, 175, 176, 172, 184, + 171, 170, 168, 167, 165, 164, 158, 189, 194, 194, + 194, 194, 195, 195, 195, 195, 196, 196, 196, 196, + + 198, 198, 198, 198, 199, 157, 156, 199, 200, 200, + 200, 200, 201, 149, 201, 201, 145, 143, 141, 140, + 139, 137, 136, 129, 128, 119, 118, 117, 95, 90, + 89, 88, 87, 76, 57, 55, 45, 44, 43, 42, + 41, 35, 33, 22, 20, 16, 15, 9, 8, 7, + 4, 3, 193, 193, 193, 193, 193, 193, 193, 193, + 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, + 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, + 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, + 193, 193, 193, 193, 193 - 196, 197, 197, 197, 197, 198, 154, 198, 198, 153, - 146, 142, 140, 138, 137, 136, 134, 133, 126, 117, - 116, 115, 94, 89, 88, 87, 86, 75, 57, 55, - 45, 44, 43, 42, 41, 35, 33, 22, 20, 16, - 15, 9, 8, 7, 4, 3, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190 } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[57] = +static yyconst flex_int32_t yy_rule_can_match_eol[58] = { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -697,7 +705,7 @@ static char *lb_steal(lex_buf *lb) -#line 701 "config_lexer.cc" +#line 709 "../../../lib/config/config_lexer.cc" #define INITIAL 0 #define C_COMMENT 1 @@ -954,7 +962,7 @@ YY_DECL lex_buf string_buf; -#line 958 "config_lexer.cc" +#line 966 "../../../lib/config/config_lexer.cc" yylval = yylval_param; @@ -1011,13 +1019,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 >= 191 ) + if ( yy_current_state >= 194 ) 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 != 190 ); + while ( yy_current_state != 193 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -1249,103 +1257,103 @@ YY_RULE_SETUP case 29: YY_RULE_SETUP #line 197 "config_lexer.ll" -{ return T_VALIDATOR; } +{ yylval->type = TypeName; return T_TYPE_NAME; } YY_BREAK case 30: YY_RULE_SETUP #line 198 "config_lexer.ll" -{ return T_REQUIRE; } +{ return T_VALIDATOR; } YY_BREAK case 31: YY_RULE_SETUP #line 199 "config_lexer.ll" -{ return T_ATTRIBUTE; } +{ return T_REQUIRE; } YY_BREAK case 32: YY_RULE_SETUP #line 200 "config_lexer.ll" -return T_ABSTRACT; +{ return T_ATTRIBUTE; } YY_BREAK case 33: YY_RULE_SETUP #line 201 "config_lexer.ll" -return T_LOCAL; +return T_ABSTRACT; YY_BREAK case 34: YY_RULE_SETUP #line 202 "config_lexer.ll" -return T_OBJECT; +return T_LOCAL; YY_BREAK case 35: YY_RULE_SETUP #line 203 "config_lexer.ll" -return T_TEMPLATE; +return T_OBJECT; YY_BREAK case 36: YY_RULE_SETUP #line 204 "config_lexer.ll" -return T_INCLUDE; +return T_TEMPLATE; YY_BREAK case 37: YY_RULE_SETUP #line 205 "config_lexer.ll" -return T_LIBRARY; +return T_INCLUDE; YY_BREAK case 38: YY_RULE_SETUP #line 206 "config_lexer.ll" -return T_INHERITS; +return T_LIBRARY; YY_BREAK case 39: YY_RULE_SETUP #line 207 "config_lexer.ll" -return T_NULL; +return T_INHERITS; YY_BREAK case 40: YY_RULE_SETUP #line 208 "config_lexer.ll" -return T_PARTIAL; +return T_NULL; YY_BREAK case 41: YY_RULE_SETUP #line 209 "config_lexer.ll" -{ yylval->num = 1; return T_NUMBER; } +return T_PARTIAL; YY_BREAK case 42: YY_RULE_SETUP #line 210 "config_lexer.ll" -{ yylval->num = 0; return T_NUMBER; } +{ yylval->num = 1; return T_NUMBER; } YY_BREAK case 43: YY_RULE_SETUP #line 211 "config_lexer.ll" -{ yylval->text = strdup(yytext); return T_IDENTIFIER; } +{ yylval->num = 0; return T_NUMBER; } YY_BREAK case 44: -/* rule 44 can match eol */ YY_RULE_SETUP #line 212 "config_lexer.ll" -{ yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING_ANGLE; } +{ yylval->text = strdup(yytext); return T_IDENTIFIER; } YY_BREAK case 45: +/* rule 45 can match eol */ YY_RULE_SETUP #line 213 "config_lexer.ll" -{ yylval->num = strtod(yytext, NULL) / 1000; return T_NUMBER; } +{ yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING_ANGLE; } YY_BREAK case 46: YY_RULE_SETUP #line 214 "config_lexer.ll" -{ yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; } +{ yylval->num = strtod(yytext, NULL) / 1000; return T_NUMBER; } YY_BREAK case 47: YY_RULE_SETUP #line 215 "config_lexer.ll" -{ yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; } +{ yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; } YY_BREAK case 48: YY_RULE_SETUP #line 216 "config_lexer.ll" -{ yylval->num = strtod(yytext, NULL); return T_NUMBER; } +{ yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; } YY_BREAK case 49: YY_RULE_SETUP @@ -1355,40 +1363,45 @@ YY_RULE_SETUP case 50: YY_RULE_SETUP #line 218 "config_lexer.ll" -{ yylval->op = OperatorSet; return T_EQUAL; } +{ yylval->num = strtod(yytext, NULL); return T_NUMBER; } YY_BREAK case 51: YY_RULE_SETUP #line 219 "config_lexer.ll" -{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; } +{ yylval->op = OperatorSet; return T_EQUAL; } YY_BREAK case 52: YY_RULE_SETUP #line 220 "config_lexer.ll" -{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; } +{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; } YY_BREAK case 53: YY_RULE_SETUP #line 221 "config_lexer.ll" -{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; } +{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; } YY_BREAK case 54: YY_RULE_SETUP #line 222 "config_lexer.ll" +{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 223 "config_lexer.ll" { yylval->op = OperatorDivide; return T_DIVIDE_EQUAL; } YY_BREAK -case 55: -YY_RULE_SETUP -#line 225 "config_lexer.ll" -return yytext[0]; - YY_BREAK case 56: YY_RULE_SETUP -#line 227 "config_lexer.ll" +#line 226 "config_lexer.ll" +return yytext[0]; + YY_BREAK +case 57: +YY_RULE_SETUP +#line 228 "config_lexer.ll" ECHO; YY_BREAK -#line 1392 "config_lexer.cc" +#line 1405 "../../../lib/config/config_lexer.cc" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(C_COMMENT): case YY_STATE_EOF(STRING): @@ -1686,7 +1699,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 >= 191 ) + if ( yy_current_state >= 194 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1715,11 +1728,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 >= 191 ) + if ( yy_current_state >= 194 ) 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 == 190); + yy_is_jam = (yy_current_state == 193); return yy_is_jam ? 0 : yy_current_state; } @@ -2578,7 +2591,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 227 "config_lexer.ll" +#line 228 "config_lexer.ll" diff --git a/lib/config/config_lexer.ll b/lib/config/config_lexer.ll index 28906277c..299e63b11 100644 --- a/lib/config/config_lexer.ll +++ b/lib/config/config_lexer.ll @@ -194,6 +194,7 @@ number { yylval->type = TypeNumber; return T_TYPE_NUMBER; } string { yylval->type = TypeString; return T_TYPE_STRING; } scalar { yylval->type = TypeScalar; return T_TYPE_SCALAR; } any { yylval->type = TypeAny; return T_TYPE_ANY; } +name { yylval->type = TypeName; return T_TYPE_NAME; } %validator { return T_VALIDATOR; } %require { return T_REQUIRE; } %attribute { return T_ATTRIBUTE; } diff --git a/lib/config/config_parser.cc b/lib/config/config_parser.cc index 02641cbda..4e970644b 100644 --- a/lib/config/config_parser.cc +++ b/lib/config/config_parser.cc @@ -67,7 +67,7 @@ /* Line 268 of yacc.c */ -#line 71 "config_parser.cc" +#line 71 "../../../lib/config/config_parser.cc" /* Enabling traces. */ #ifndef YYDEBUG @@ -136,7 +136,7 @@ using namespace icinga; /* Line 288 of yacc.c */ -#line 140 "config_parser.cc" +#line 140 "../../../lib/config/config_parser.cc" /* Tokens. */ #ifndef YYTOKENTYPE @@ -160,18 +160,19 @@ using namespace icinga; T_TYPE_STRING = 271, T_TYPE_SCALAR = 272, T_TYPE_ANY = 273, - T_VALIDATOR = 274, - T_REQUIRE = 275, - T_ATTRIBUTE = 276, - T_TYPE = 277, - T_ABSTRACT = 278, - T_LOCAL = 279, - T_OBJECT = 280, - T_TEMPLATE = 281, - T_INCLUDE = 282, - T_LIBRARY = 283, - T_INHERITS = 284, - T_PARTIAL = 285 + T_TYPE_NAME = 274, + T_VALIDATOR = 275, + T_REQUIRE = 276, + T_ATTRIBUTE = 277, + T_TYPE = 278, + T_ABSTRACT = 279, + T_LOCAL = 280, + T_OBJECT = 281, + T_TEMPLATE = 282, + T_INCLUDE = 283, + T_LIBRARY = 284, + T_INHERITS = 285, + T_PARTIAL = 286 }; #endif /* Tokens. */ @@ -191,18 +192,19 @@ using namespace icinga; #define T_TYPE_STRING 271 #define T_TYPE_SCALAR 272 #define T_TYPE_ANY 273 -#define T_VALIDATOR 274 -#define T_REQUIRE 275 -#define T_ATTRIBUTE 276 -#define T_TYPE 277 -#define T_ABSTRACT 278 -#define T_LOCAL 279 -#define T_OBJECT 280 -#define T_TEMPLATE 281 -#define T_INCLUDE 282 -#define T_LIBRARY 283 -#define T_INHERITS 284 -#define T_PARTIAL 285 +#define T_TYPE_NAME 274 +#define T_VALIDATOR 275 +#define T_REQUIRE 276 +#define T_ATTRIBUTE 277 +#define T_TYPE 278 +#define T_ABSTRACT 279 +#define T_LOCAL 280 +#define T_OBJECT 281 +#define T_TEMPLATE 282 +#define T_INCLUDE 283 +#define T_LIBRARY 284 +#define T_INHERITS 285 +#define T_PARTIAL 286 @@ -227,7 +229,7 @@ typedef union YYSTYPE /* Line 293 of yacc.c */ -#line 231 "config_parser.cc" +#line 233 "../../../lib/config/config_parser.cc" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -251,7 +253,7 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ /* Line 343 of yacc.c */ -#line 111 "config_parser.yy" +#line 112 "config_parser.yy" int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner); @@ -288,7 +290,7 @@ void ConfigCompiler::Compile(void) /* Line 343 of yacc.c */ -#line 292 "config_parser.cc" +#line 294 "../../../lib/config/config_parser.cc" #ifdef short # undef short @@ -509,20 +511,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 78 +#define YYLAST 85 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 40 +#define YYNTOKENS 43 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 32 /* YYNRULES -- Number of rules. */ -#define YYNRULES 73 +#define YYNRULES 75 /* YYNRULES -- Number of states. */ -#define YYNSTATES 96 +#define YYNSTATES 102 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 285 +#define YYMAXUTOK 286 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -534,15 +536,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, 33, 31, 37, 32, 2, 34, 2, 2, + 39, 40, 34, 32, 38, 33, 2, 35, 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, 38, 2, 39, 2, 2, 2, 2, 2, 2, + 2, 41, 2, 42, 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, 35, 2, 36, 2, 2, 2, 2, + 2, 2, 2, 36, 2, 37, 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, @@ -558,7 +560,7 @@ static const yytype_uint8 yytranslate[] = 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, 24, - 25, 26, 27, 28, 29, 30 + 25, 26, 27, 28, 29, 30, 31 }; #if YYDEBUG @@ -568,49 +570,50 @@ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 4, 7, 9, 11, 13, 15, 18, 21, 24, 26, 28, 29, 36, 37, 39, 40, 45, - 47, 50, 51, 53, 57, 60, 63, 67, 72, 73, - 76, 78, 80, 82, 84, 86, 88, 89, 96, 99, - 101, 102, 105, 107, 109, 110, 112, 116, 117, 120, - 124, 126, 129, 130, 132, 136, 140, 147, 149, 151, - 153, 155, 157, 161, 163, 166, 167, 169, 173, 175, - 177, 179, 181, 183 + 47, 50, 51, 53, 57, 60, 63, 67, 74, 79, + 80, 83, 85, 87, 89, 91, 93, 95, 97, 98, + 105, 108, 110, 111, 114, 116, 118, 119, 121, 125, + 126, 129, 133, 135, 138, 139, 141, 145, 149, 156, + 158, 160, 162, 164, 166, 170, 172, 175, 176, 178, + 182, 184, 186, 188, 190, 192 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 41, 0, -1, -1, 41, 42, -1, 55, -1, 46, - -1, 43, -1, 44, -1, 27, 3, -1, 27, 4, - -1, 28, 3, -1, 7, -1, 3, -1, -1, 48, - 22, 45, 47, 54, 49, -1, -1, 30, -1, -1, - 35, 50, 51, 36, -1, 52, -1, 52, 37, -1, - -1, 53, -1, 52, 37, 53, -1, 20, 3, -1, - 19, 3, -1, 21, 46, 3, -1, 21, 46, 3, - 49, -1, -1, 29, 3, -1, 13, -1, 14, -1, - 15, -1, 16, -1, 17, -1, 18, -1, -1, 56, - 57, 45, 3, 61, 62, -1, 58, 25, -1, 26, - -1, -1, 58, 59, -1, 23, -1, 24, -1, -1, - 3, -1, 60, 37, 3, -1, -1, 29, 60, -1, - 35, 63, 36, -1, 64, -1, 64, 37, -1, -1, - 65, -1, 64, 37, 65, -1, 45, 66, 71, -1, - 45, 38, 3, 39, 66, 71, -1, 8, -1, 9, - -1, 10, -1, 11, -1, 12, -1, 38, 68, 39, - -1, 69, -1, 69, 37, -1, -1, 71, -1, 69, - 37, 71, -1, 3, -1, 5, -1, 6, -1, 67, - -1, 70, -1, 62, -1 + 44, 0, -1, -1, 44, 45, -1, 58, -1, 49, + -1, 46, -1, 47, -1, 28, 3, -1, 28, 4, + -1, 29, 3, -1, 7, -1, 3, -1, -1, 51, + 23, 48, 50, 57, 52, -1, -1, 31, -1, -1, + 36, 53, 54, 37, -1, 55, -1, 55, 38, -1, + -1, 56, -1, 55, 38, 56, -1, 21, 3, -1, + 20, 3, -1, 22, 49, 3, -1, 22, 19, 39, + 48, 40, 3, -1, 22, 49, 3, 52, -1, -1, + 30, 3, -1, 13, -1, 14, -1, 15, -1, 16, + -1, 17, -1, 18, -1, 19, -1, -1, 59, 60, + 48, 3, 64, 65, -1, 61, 26, -1, 27, -1, + -1, 61, 62, -1, 24, -1, 25, -1, -1, 3, + -1, 63, 38, 3, -1, -1, 30, 63, -1, 36, + 66, 37, -1, 67, -1, 67, 38, -1, -1, 68, + -1, 67, 38, 68, -1, 48, 69, 74, -1, 48, + 41, 3, 42, 69, 74, -1, 8, -1, 9, -1, + 10, -1, 11, -1, 12, -1, 41, 71, 42, -1, + 72, -1, 72, 38, -1, -1, 74, -1, 72, 38, + 74, -1, 3, -1, 5, -1, 6, -1, 70, -1, + 73, -1, 65, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 147, 147, 148, 151, 151, 151, 151, 154, 159, - 165, 171, 172, 179, 178, 208, 211, 218, 217, 229, - 230, 232, 233, 234, 237, 242, 247, 254, 263, 264, - 271, 272, 273, 274, 275, 276, 283, 283, 320, 321, - 326, 327, 330, 334, 341, 344, 350, 363, 366, 372, - 378, 382, 388, 391, 397, 409, 415, 429, 430, 431, - 432, 433, 439, 445, 449, 455, 458, 464, 476, 481, - 485, 489, 499, 500 + 0, 148, 148, 149, 152, 152, 152, 152, 155, 160, + 166, 172, 173, 180, 179, 209, 212, 219, 218, 230, + 231, 233, 234, 235, 238, 243, 248, 255, 263, 272, + 273, 280, 281, 282, 283, 284, 285, 286, 293, 293, + 330, 331, 336, 337, 340, 344, 351, 354, 360, 373, + 376, 382, 388, 392, 398, 401, 407, 419, 425, 439, + 440, 441, 442, 443, 449, 455, 459, 465, 468, 474, + 486, 491, 495, 499, 509, 510 }; #endif @@ -625,15 +628,16 @@ static const char *const yytname[] = "\"/= (T_DIVIDE_EQUAL)\"", "\"dictionary (T_TYPE_DICTIONARY)\"", "\"array (T_TYPE_ARRAY)\"", "\"number (T_TYPE_NUMBER)\"", "\"string (T_TYPE_STRING)\"", "\"scalar (T_TYPE_SCALAR)\"", - "\"any (T_TYPE_ANY)\"", "\"%validator (T_VALIDATOR)\"", - "\"%require (T_REQUIRE)\"", "\"%attribute (T_ATTRIBUTE)\"", - "\"type (T_TYPE)\"", "\"abstract (T_ABSTRACT)\"", "\"local (T_LOCAL)\"", + "\"any (T_TYPE_ANY)\"", "\"name (T_TYPE_NAME)\"", + "\"%validator (T_VALIDATOR)\"", "\"%require (T_REQUIRE)\"", + "\"%attribute (T_ATTRIBUTE)\"", "\"type (T_TYPE)\"", + "\"abstract (T_ABSTRACT)\"", "\"local (T_LOCAL)\"", "\"object (T_OBJECT)\"", "\"template (T_TEMPLATE)\"", "\"include (T_INCLUDE)\"", "\"library (T_LIBRARY)\"", "\"inherits (T_INHERITS)\"", "\"partial (T_PARTIAL)\"", "'+'", "'-'", - "'*'", "'/'", "'{'", "'}'", "','", "'['", "']'", "$accept", "statements", - "statement", "include", "library", "identifier", "type", "$@1", - "partial_specifier", "typerulelist", "$@2", "typerules", + "'*'", "'/'", "'{'", "'}'", "','", "'('", "')'", "'['", "']'", "$accept", + "statements", "statement", "include", "library", "identifier", "type", + "$@1", "partial_specifier", "typerulelist", "$@2", "typerules", "typerules_inner", "typerule", "type_inherits_specifier", "object", "$@3", "object_declaration", "attributes", "attribute", "object_inherits_list", "object_inherits_specifier", "expressionlist", @@ -650,21 +654,22 @@ 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, 279, 280, 281, 282, 283, 284, - 285, 43, 45, 42, 47, 123, 125, 44, 91, 93 + 285, 286, 43, 45, 42, 47, 123, 125, 44, 40, + 41, 91, 93 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 40, 41, 41, 42, 42, 42, 42, 43, 43, - 44, 45, 45, 47, 46, 48, 48, 50, 49, 51, - 51, 52, 52, 52, 53, 53, 53, 53, 54, 54, - 46, 46, 46, 46, 46, 46, 56, 55, 57, 57, - 58, 58, 59, 59, 60, 60, 60, 61, 61, 62, - 63, 63, 64, 64, 64, 65, 65, 66, 66, 66, - 66, 66, 67, 68, 68, 69, 69, 69, 70, 70, - 70, 70, 71, 71 + 0, 43, 44, 44, 45, 45, 45, 45, 46, 46, + 47, 48, 48, 50, 49, 51, 51, 53, 52, 54, + 54, 55, 55, 55, 56, 56, 56, 56, 56, 57, + 57, 49, 49, 49, 49, 49, 49, 49, 59, 58, + 60, 60, 61, 61, 62, 62, 63, 63, 63, 64, + 64, 65, 66, 66, 67, 67, 67, 68, 68, 69, + 69, 69, 69, 69, 70, 71, 71, 72, 72, 72, + 73, 73, 73, 73, 74, 74 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -672,12 +677,12 @@ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 1, 1, 1, 1, 2, 2, 2, 1, 1, 0, 6, 0, 1, 0, 4, 1, - 2, 0, 1, 3, 2, 2, 3, 4, 0, 2, - 1, 1, 1, 1, 1, 1, 0, 6, 2, 1, - 0, 2, 1, 1, 0, 1, 3, 0, 2, 3, - 1, 2, 0, 1, 3, 3, 6, 1, 1, 1, - 1, 1, 3, 1, 2, 0, 1, 3, 1, 1, - 1, 1, 1, 1 + 2, 0, 1, 3, 2, 2, 3, 6, 4, 0, + 2, 1, 1, 1, 1, 1, 1, 1, 0, 6, + 2, 1, 0, 2, 1, 1, 0, 1, 3, 0, + 2, 3, 1, 2, 0, 1, 3, 3, 6, 1, + 1, 1, 1, 1, 3, 1, 2, 0, 1, 3, + 1, 1, 1, 1, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. @@ -685,51 +690,53 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 2, 36, 1, 30, 31, 32, 33, 34, 35, 0, - 0, 16, 3, 6, 7, 5, 0, 4, 40, 8, - 9, 10, 0, 39, 0, 0, 12, 11, 13, 0, - 42, 43, 38, 41, 28, 47, 0, 0, 44, 0, - 29, 17, 14, 45, 48, 52, 37, 21, 0, 0, - 0, 50, 53, 0, 0, 15, 0, 19, 22, 46, - 57, 58, 59, 60, 61, 0, 0, 49, 51, 25, - 24, 0, 18, 20, 0, 68, 69, 70, 65, 73, - 71, 72, 55, 54, 26, 23, 0, 0, 63, 66, - 27, 0, 62, 64, 56, 67 + 2, 38, 1, 31, 32, 33, 34, 35, 36, 37, + 0, 0, 16, 3, 6, 7, 5, 0, 4, 42, + 8, 9, 10, 0, 41, 0, 0, 12, 11, 13, + 0, 44, 45, 40, 43, 29, 49, 0, 0, 46, + 0, 30, 17, 14, 47, 50, 54, 39, 21, 0, + 0, 0, 52, 55, 0, 0, 15, 0, 19, 22, + 48, 59, 60, 61, 62, 63, 0, 0, 51, 53, + 25, 24, 37, 0, 18, 20, 0, 70, 71, 72, + 67, 75, 73, 74, 57, 56, 0, 26, 23, 0, + 0, 65, 68, 0, 28, 0, 64, 66, 0, 58, + 69, 27 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 12, 13, 14, 49, 15, 34, 16, 42, - 47, 56, 57, 58, 37, 17, 18, 24, 25, 33, - 44, 39, 79, 50, 51, 52, 66, 80, 87, 88, - 81, 82 + -1, 1, 13, 14, 15, 50, 16, 35, 17, 43, + 48, 57, 58, 59, 38, 18, 19, 25, 26, 34, + 45, 40, 81, 51, 52, 53, 67, 82, 90, 91, + 83, 84 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -70 +#define YYPACT_NINF -48 static const yytype_int8 yypact[] = { - -70, 1, -70, -70, -70, -70, -70, -70, -70, 47, - 10, -70, -70, -70, -70, -70, -2, -70, 0, -70, - -70, -70, 18, -70, 18, -13, -70, -70, -70, 24, - -70, -70, -70, -70, 4, 26, 27, 21, 54, 25, - -70, -70, -70, -70, 22, 18, -70, 28, 55, -4, - 29, 31, -70, 58, 59, 23, 33, 35, -70, -70, - -70, -70, -70, -70, -70, 60, -3, -70, 18, -70, - -70, 61, -70, 28, 32, -70, -70, -70, -3, -70, - -70, -70, -70, -70, 21, -70, 34, 36, 37, -70, - -70, -3, -70, -3, -70, -70 + -48, 12, -48, -48, -48, -48, -48, -48, -48, -48, + 7, 10, -48, -48, -48, -48, -48, 13, -48, -6, + -48, -48, -48, 39, -48, 39, 32, -48, -48, -48, + 34, -48, -48, -48, -48, 14, 15, 44, 23, 46, + 24, -48, -48, -48, -48, 26, 39, -48, 2, 58, + -3, 25, 27, -48, 63, 64, 1, 31, 33, -48, + -48, -48, -48, -48, -48, -48, 66, -2, -48, 39, + -48, -48, 35, 67, -48, 2, 30, -48, -48, -48, + -2, -48, -48, -48, -48, -48, 39, 23, -48, 43, + 36, 37, -48, 40, -48, -2, -48, -2, 70, -48, + -48, -48 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -70, -70, -70, -70, -70, 30, 11, -70, -70, -17, - -70, -70, -70, 3, -70, -70, -70, -70, -70, -70, - -70, -70, 38, -70, -70, 2, -8, -70, -70, -70, - -70, -69 + -48, -48, -48, -48, -48, -23, 20, -48, -48, -10, + -48, -48, -48, 4, -48, -48, -48, -48, -48, -48, + -48, -48, 41, -48, -48, 16, -7, -48, -48, -48, + -48, -47 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -738,48 +745,51 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -16 static const yytype_int8 yytable[] = { - 75, 2, 76, 77, 60, 61, 62, 63, 64, 89, - 30, 31, 32, 21, 3, 4, 5, 6, 7, 8, - 22, 26, 94, -15, 95, 27, 23, 35, 9, 10, - 40, 11, 45, 36, 65, 78, 3, 4, 5, 6, - 7, 8, 60, 61, 62, 63, 64, 53, 54, 55, - 19, 20, 28, 11, 29, 38, 41, 43, 59, 48, - 45, 69, 70, 74, 84, 67, 71, 90, 68, 72, - 83, 86, 73, 0, 93, 92, 85, 46, 91 + 29, 77, 30, 78, 79, 61, 62, 63, 64, 65, + 20, 21, 2, 22, 3, 4, 5, 6, 7, 8, + 72, 24, 54, 55, 56, 3, 4, 5, 6, 7, + 8, 9, 12, 92, 46, -15, 23, 36, 66, 80, + 10, 11, 27, 12, 37, 39, 28, 41, 99, 44, + 100, 61, 62, 63, 64, 65, 31, 32, 33, 42, + 46, 60, 68, 93, 49, 69, 70, 71, 74, 76, + 87, 75, 89, 101, 86, 97, 73, 94, 96, 88, + 98, 47, 95, 0, 0, 85 }; #define yypact_value_is_default(yystate) \ - ((yystate) == (-70)) + ((yystate) == (-48)) #define yytable_value_is_error(yytable_value) \ YYID (0) static const yytype_int8 yycheck[] = { - 3, 0, 5, 6, 8, 9, 10, 11, 12, 78, - 23, 24, 25, 3, 13, 14, 15, 16, 17, 18, - 22, 3, 91, 22, 93, 7, 26, 3, 27, 28, - 3, 30, 35, 29, 38, 38, 13, 14, 15, 16, - 17, 18, 8, 9, 10, 11, 12, 19, 20, 21, - 3, 4, 22, 30, 24, 29, 35, 3, 3, 37, - 35, 3, 3, 3, 3, 36, 55, 84, 37, 36, - 68, 39, 37, -1, 37, 39, 73, 39, 86 + 23, 3, 25, 5, 6, 8, 9, 10, 11, 12, + 3, 4, 0, 3, 13, 14, 15, 16, 17, 18, + 19, 27, 20, 21, 22, 13, 14, 15, 16, 17, + 18, 19, 31, 80, 36, 23, 23, 3, 41, 41, + 28, 29, 3, 31, 30, 30, 7, 3, 95, 3, + 97, 8, 9, 10, 11, 12, 24, 25, 26, 36, + 36, 3, 37, 86, 38, 38, 3, 3, 37, 3, + 3, 38, 42, 3, 39, 38, 56, 87, 42, 75, + 40, 40, 89, -1, -1, 69 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 41, 0, 13, 14, 15, 16, 17, 18, 27, - 28, 30, 42, 43, 44, 46, 48, 55, 56, 3, - 4, 3, 22, 26, 57, 58, 3, 7, 45, 45, - 23, 24, 25, 59, 47, 3, 29, 54, 29, 61, - 3, 35, 49, 3, 60, 35, 62, 50, 37, 45, - 63, 64, 65, 19, 20, 21, 51, 52, 53, 3, - 8, 9, 10, 11, 12, 38, 66, 36, 37, 3, - 3, 46, 36, 37, 3, 3, 5, 6, 38, 62, - 67, 70, 71, 65, 3, 53, 39, 68, 69, 71, - 49, 66, 39, 37, 71, 71 + 0, 44, 0, 13, 14, 15, 16, 17, 18, 19, + 28, 29, 31, 45, 46, 47, 49, 51, 58, 59, + 3, 4, 3, 23, 27, 60, 61, 3, 7, 48, + 48, 24, 25, 26, 62, 50, 3, 30, 57, 30, + 64, 3, 36, 52, 3, 63, 36, 65, 53, 38, + 48, 66, 67, 68, 20, 21, 22, 54, 55, 56, + 3, 8, 9, 10, 11, 12, 41, 69, 37, 38, + 3, 3, 19, 49, 37, 38, 3, 3, 5, 6, + 41, 65, 70, 73, 74, 68, 39, 3, 56, 42, + 71, 72, 74, 48, 52, 69, 42, 38, 40, 74, + 74, 3 }; #define yyerrok (yyerrstatus = 0) @@ -1665,7 +1675,7 @@ yyreduce: case 8: /* Line 1806 of yacc.c */ -#line 155 "config_parser.yy" +#line 156 "config_parser.yy" { context->HandleInclude((yyvsp[(2) - (2)].text), false, yylloc); free((yyvsp[(2) - (2)].text)); @@ -1675,7 +1685,7 @@ yyreduce: case 9: /* Line 1806 of yacc.c */ -#line 160 "config_parser.yy" +#line 161 "config_parser.yy" { context->HandleInclude((yyvsp[(2) - (2)].text), true, yylloc); free((yyvsp[(2) - (2)].text)); @@ -1685,7 +1695,7 @@ yyreduce: case 10: /* Line 1806 of yacc.c */ -#line 166 "config_parser.yy" +#line 167 "config_parser.yy" { context->HandleLibrary((yyvsp[(2) - (2)].text)); free((yyvsp[(2) - (2)].text)); @@ -1695,7 +1705,7 @@ yyreduce: case 12: /* Line 1806 of yacc.c */ -#line 173 "config_parser.yy" +#line 174 "config_parser.yy" { (yyval.text) = (yyvsp[(1) - (1)].text); } @@ -1704,7 +1714,7 @@ yyreduce: case 13: /* Line 1806 of yacc.c */ -#line 179 "config_parser.yy" +#line 180 "config_parser.yy" { String name = String((yyvsp[(3) - (3)].text)); free((yyvsp[(3) - (3)].text)); @@ -1724,7 +1734,7 @@ yyreduce: case 14: /* Line 1806 of yacc.c */ -#line 194 "config_parser.yy" +#line 195 "config_parser.yy" { TypeRuleList::Ptr ruleList = *(yyvsp[(6) - (6)].variant); m_Type->GetRuleList()->AddRules(ruleList); @@ -1741,7 +1751,7 @@ yyreduce: case 15: /* Line 1806 of yacc.c */ -#line 208 "config_parser.yy" +#line 209 "config_parser.yy" { (yyval.num) = 0; } @@ -1750,7 +1760,7 @@ yyreduce: case 16: /* Line 1806 of yacc.c */ -#line 212 "config_parser.yy" +#line 213 "config_parser.yy" { (yyval.num) = 1; } @@ -1759,7 +1769,7 @@ yyreduce: case 17: /* Line 1806 of yacc.c */ -#line 218 "config_parser.yy" +#line 219 "config_parser.yy" { m_RuleLists.push(boost::make_shared()); } @@ -1768,7 +1778,7 @@ yyreduce: case 18: /* Line 1806 of yacc.c */ -#line 223 "config_parser.yy" +#line 224 "config_parser.yy" { (yyval.variant) = new Value(m_RuleLists.top()); m_RuleLists.pop(); @@ -1778,7 +1788,7 @@ yyreduce: case 24: /* Line 1806 of yacc.c */ -#line 238 "config_parser.yy" +#line 239 "config_parser.yy" { m_RuleLists.top()->AddRequire((yyvsp[(2) - (2)].text)); free((yyvsp[(2) - (2)].text)); @@ -1788,7 +1798,7 @@ yyreduce: case 25: /* Line 1806 of yacc.c */ -#line 243 "config_parser.yy" +#line 244 "config_parser.yy" { m_RuleLists.top()->SetValidator((yyvsp[(2) - (2)].text)); free((yyvsp[(2) - (2)].text)); @@ -1798,9 +1808,9 @@ yyreduce: case 26: /* Line 1806 of yacc.c */ -#line 248 "config_parser.yy" +#line 249 "config_parser.yy" { - TypeRule rule((yyvsp[(2) - (3)].type), (yyvsp[(3) - (3)].text), TypeRuleList::Ptr(), yylloc); + TypeRule rule((yyvsp[(2) - (3)].type), String(), (yyvsp[(3) - (3)].text), TypeRuleList::Ptr(), yylloc); free((yyvsp[(3) - (3)].text)); m_RuleLists.top()->AddRule(rule); @@ -1810,48 +1820,61 @@ yyreduce: case 27: /* Line 1806 of yacc.c */ -#line 255 "config_parser.yy" +#line 256 "config_parser.yy" { - TypeRule rule((yyvsp[(2) - (4)].type), (yyvsp[(3) - (4)].text), *(yyvsp[(4) - (4)].variant), yylloc); + TypeRule rule((yyvsp[(2) - (6)].type), (yyvsp[(4) - (6)].text), (yyvsp[(6) - (6)].text), TypeRuleList::Ptr(), yylloc); + free((yyvsp[(4) - (6)].text)); + free((yyvsp[(6) - (6)].text)); + + m_RuleLists.top()->AddRule(rule); + } + break; + + case 28: + +/* Line 1806 of yacc.c */ +#line 264 "config_parser.yy" + { + TypeRule rule((yyvsp[(2) - (4)].type), String(), (yyvsp[(3) - (4)].text), *(yyvsp[(4) - (4)].variant), yylloc); free((yyvsp[(3) - (4)].text)); delete (yyvsp[(4) - (4)].variant); m_RuleLists.top()->AddRule(rule); } break; - case 29: + case 30: /* Line 1806 of yacc.c */ -#line 265 "config_parser.yy" +#line 274 "config_parser.yy" { m_Type->SetParent((yyvsp[(2) - (2)].text)); free((yyvsp[(2) - (2)].text)); } break; - case 35: + case 37: /* Line 1806 of yacc.c */ -#line 277 "config_parser.yy" +#line 287 "config_parser.yy" { (yyval.type) = (yyvsp[(1) - (1)].type); } break; - case 36: + case 38: /* Line 1806 of yacc.c */ -#line 283 "config_parser.yy" +#line 293 "config_parser.yy" { m_Abstract = false; m_Local = false; } break; - case 37: + case 39: /* Line 1806 of yacc.c */ -#line 288 "config_parser.yy" +#line 298 "config_parser.yy" { ConfigItemBuilder::Ptr item = boost::make_shared(yylloc); @@ -1884,39 +1907,21 @@ yyreduce: } break; - case 39: + case 41: /* Line 1806 of yacc.c */ -#line 322 "config_parser.yy" +#line 332 "config_parser.yy" { m_Abstract = true; } break; - case 42: - -/* Line 1806 of yacc.c */ -#line 331 "config_parser.yy" - { - m_Abstract = true; - } - break; - - case 43: - -/* Line 1806 of yacc.c */ -#line 335 "config_parser.yy" - { - m_Local = true; - } - break; - case 44: /* Line 1806 of yacc.c */ #line 341 "config_parser.yy" { - (yyval.slist) = NULL; + m_Abstract = true; } break; @@ -1925,9 +1930,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 345 "config_parser.yy" { - (yyval.slist) = new std::vector(); - (yyval.slist)->push_back((yyvsp[(1) - (1)].text)); - free((yyvsp[(1) - (1)].text)); + m_Local = true; } break; @@ -1935,6 +1938,26 @@ yyreduce: /* Line 1806 of yacc.c */ #line 351 "config_parser.yy" + { + (yyval.slist) = NULL; + } + break; + + case 47: + +/* Line 1806 of yacc.c */ +#line 355 "config_parser.yy" + { + (yyval.slist) = new std::vector(); + (yyval.slist)->push_back((yyvsp[(1) - (1)].text)); + free((yyvsp[(1) - (1)].text)); + } + break; + + case 48: + +/* Line 1806 of yacc.c */ +#line 361 "config_parser.yy" { if ((yyvsp[(1) - (3)].slist)) (yyval.slist) = (yyvsp[(1) - (3)].slist); @@ -1946,39 +1969,21 @@ yyreduce: } break; - case 47: - -/* Line 1806 of yacc.c */ -#line 363 "config_parser.yy" - { - (yyval.slist) = NULL; - } - break; - - case 48: - -/* Line 1806 of yacc.c */ -#line 367 "config_parser.yy" - { - (yyval.slist) = (yyvsp[(2) - (2)].slist); - } - break; - case 49: /* Line 1806 of yacc.c */ #line 373 "config_parser.yy" { - (yyval.exprl) = (yyvsp[(2) - (3)].exprl); + (yyval.slist) = NULL; } break; case 50: /* Line 1806 of yacc.c */ -#line 379 "config_parser.yy" +#line 377 "config_parser.yy" { - (yyval.exprl) = (yyvsp[(1) - (1)].exprl); + (yyval.slist) = (yyvsp[(2) - (2)].slist); } break; @@ -1987,27 +1992,25 @@ yyreduce: /* Line 1806 of yacc.c */ #line 383 "config_parser.yy" { - (yyval.exprl) = (yyvsp[(1) - (2)].exprl); + (yyval.exprl) = (yyvsp[(2) - (3)].exprl); } break; case 52: /* Line 1806 of yacc.c */ -#line 388 "config_parser.yy" +#line 389 "config_parser.yy" { - (yyval.exprl) = NULL; + (yyval.exprl) = (yyvsp[(1) - (1)].exprl); } break; case 53: /* Line 1806 of yacc.c */ -#line 392 "config_parser.yy" +#line 393 "config_parser.yy" { - (yyval.exprl) = new ExpressionList(); - (yyval.exprl)->AddExpression(*(yyvsp[(1) - (1)].expr)); - delete (yyvsp[(1) - (1)].expr); + (yyval.exprl) = (yyvsp[(1) - (2)].exprl); } break; @@ -2015,6 +2018,26 @@ yyreduce: /* Line 1806 of yacc.c */ #line 398 "config_parser.yy" + { + (yyval.exprl) = NULL; + } + break; + + case 55: + +/* Line 1806 of yacc.c */ +#line 402 "config_parser.yy" + { + (yyval.exprl) = new ExpressionList(); + (yyval.exprl)->AddExpression(*(yyvsp[(1) - (1)].expr)); + delete (yyvsp[(1) - (1)].expr); + } + break; + + case 56: + +/* Line 1806 of yacc.c */ +#line 408 "config_parser.yy" { if ((yyvsp[(1) - (3)].exprl)) (yyval.exprl) = (yyvsp[(1) - (3)].exprl); @@ -2026,10 +2049,10 @@ yyreduce: } break; - case 55: + case 57: /* Line 1806 of yacc.c */ -#line 410 "config_parser.yy" +#line 420 "config_parser.yy" { (yyval.expr) = new Expression((yyvsp[(1) - (3)].text), (yyvsp[(2) - (3)].op), *(yyvsp[(3) - (3)].variant), yylloc); free((yyvsp[(1) - (3)].text)); @@ -2037,10 +2060,10 @@ yyreduce: } break; - case 56: + case 58: /* Line 1806 of yacc.c */ -#line 416 "config_parser.yy" +#line 426 "config_parser.yy" { Expression subexpr((yyvsp[(3) - (6)].text), (yyvsp[(5) - (6)].op), *(yyvsp[(6) - (6)].variant), yylloc); free((yyvsp[(3) - (6)].text)); @@ -2054,30 +2077,12 @@ yyreduce: } break; - case 61: - -/* Line 1806 of yacc.c */ -#line 434 "config_parser.yy" - { - (yyval.op) = (yyvsp[(1) - (1)].op); - } - break; - - case 62: - -/* Line 1806 of yacc.c */ -#line 440 "config_parser.yy" - { - (yyval.array) = (yyvsp[(2) - (3)].array); - } - break; - case 63: /* Line 1806 of yacc.c */ -#line 446 "config_parser.yy" +#line 444 "config_parser.yy" { - (yyval.array) = (yyvsp[(1) - (1)].array); + (yyval.op) = (yyvsp[(1) - (1)].op); } break; @@ -2086,27 +2091,25 @@ yyreduce: /* Line 1806 of yacc.c */ #line 450 "config_parser.yy" { - (yyval.array) = (yyvsp[(1) - (2)].array); + (yyval.array) = (yyvsp[(2) - (3)].array); } break; case 65: /* Line 1806 of yacc.c */ -#line 455 "config_parser.yy" +#line 456 "config_parser.yy" { - (yyval.array) = NULL; + (yyval.array) = (yyvsp[(1) - (1)].array); } break; case 66: /* Line 1806 of yacc.c */ -#line 459 "config_parser.yy" +#line 460 "config_parser.yy" { - (yyval.array) = new Array(); - (yyval.array)->Add(*(yyvsp[(1) - (1)].variant)); - delete (yyvsp[(1) - (1)].variant); + (yyval.array) = (yyvsp[(1) - (2)].array); } break; @@ -2114,6 +2117,26 @@ yyreduce: /* Line 1806 of yacc.c */ #line 465 "config_parser.yy" + { + (yyval.array) = NULL; + } + break; + + case 68: + +/* Line 1806 of yacc.c */ +#line 469 "config_parser.yy" + { + (yyval.array) = new Array(); + (yyval.array)->Add(*(yyvsp[(1) - (1)].variant)); + delete (yyvsp[(1) - (1)].variant); + } + break; + + case 69: + +/* Line 1806 of yacc.c */ +#line 475 "config_parser.yy" { if ((yyvsp[(1) - (3)].array)) (yyval.array) = (yyvsp[(1) - (3)].array); @@ -2125,38 +2148,38 @@ yyreduce: } break; - case 68: + case 70: /* Line 1806 of yacc.c */ -#line 477 "config_parser.yy" +#line 487 "config_parser.yy" { (yyval.variant) = new Value((yyvsp[(1) - (1)].text)); free((yyvsp[(1) - (1)].text)); } break; - case 69: + case 71: /* Line 1806 of yacc.c */ -#line 482 "config_parser.yy" +#line 492 "config_parser.yy" { (yyval.variant) = new Value((yyvsp[(1) - (1)].num)); } break; - case 70: + case 72: /* Line 1806 of yacc.c */ -#line 486 "config_parser.yy" +#line 496 "config_parser.yy" { (yyval.variant) = new Value(); } break; - case 71: + case 73: /* Line 1806 of yacc.c */ -#line 490 "config_parser.yy" +#line 500 "config_parser.yy" { if ((yyvsp[(1) - (1)].array) == NULL) (yyvsp[(1) - (1)].array) = new Array(); @@ -2166,10 +2189,10 @@ yyreduce: } break; - case 73: + case 75: /* Line 1806 of yacc.c */ -#line 501 "config_parser.yy" +#line 511 "config_parser.yy" { ExpressionList::Ptr exprl = ExpressionList::Ptr((yyvsp[(1) - (1)].exprl)); (yyval.variant) = new Value(exprl); @@ -2179,7 +2202,7 @@ yyreduce: /* Line 1806 of yacc.c */ -#line 2183 "config_parser.cc" +#line 2206 "../../../lib/config/config_parser.cc" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2417,6 +2440,6 @@ yyreturn: /* Line 2067 of yacc.c */ -#line 506 "config_parser.yy" +#line 516 "config_parser.yy" diff --git a/lib/config/config_parser.h b/lib/config/config_parser.h index 74bbac7af..15bd6300c 100644 --- a/lib/config/config_parser.h +++ b/lib/config/config_parser.h @@ -79,7 +79,7 @@ using namespace icinga; /* Line 2068 of yacc.c */ -#line 83 "config_parser.h" +#line 83 "../../../lib/config/config_parser.h" /* Tokens. */ #ifndef YYTOKENTYPE @@ -103,18 +103,19 @@ using namespace icinga; T_TYPE_STRING = 271, T_TYPE_SCALAR = 272, T_TYPE_ANY = 273, - T_VALIDATOR = 274, - T_REQUIRE = 275, - T_ATTRIBUTE = 276, - T_TYPE = 277, - T_ABSTRACT = 278, - T_LOCAL = 279, - T_OBJECT = 280, - T_TEMPLATE = 281, - T_INCLUDE = 282, - T_LIBRARY = 283, - T_INHERITS = 284, - T_PARTIAL = 285 + T_TYPE_NAME = 274, + T_VALIDATOR = 275, + T_REQUIRE = 276, + T_ATTRIBUTE = 277, + T_TYPE = 278, + T_ABSTRACT = 279, + T_LOCAL = 280, + T_OBJECT = 281, + T_TEMPLATE = 282, + T_INCLUDE = 283, + T_LIBRARY = 284, + T_INHERITS = 285, + T_PARTIAL = 286 }; #endif /* Tokens. */ @@ -134,18 +135,19 @@ using namespace icinga; #define T_TYPE_STRING 271 #define T_TYPE_SCALAR 272 #define T_TYPE_ANY 273 -#define T_VALIDATOR 274 -#define T_REQUIRE 275 -#define T_ATTRIBUTE 276 -#define T_TYPE 277 -#define T_ABSTRACT 278 -#define T_LOCAL 279 -#define T_OBJECT 280 -#define T_TEMPLATE 281 -#define T_INCLUDE 282 -#define T_LIBRARY 283 -#define T_INHERITS 284 -#define T_PARTIAL 285 +#define T_TYPE_NAME 274 +#define T_VALIDATOR 275 +#define T_REQUIRE 276 +#define T_ATTRIBUTE 277 +#define T_TYPE 278 +#define T_ABSTRACT 279 +#define T_LOCAL 280 +#define T_OBJECT 281 +#define T_TEMPLATE 282 +#define T_INCLUDE 283 +#define T_LIBRARY 284 +#define T_INHERITS 285 +#define T_PARTIAL 286 @@ -170,7 +172,7 @@ typedef union YYSTYPE /* Line 2068 of yacc.c */ -#line 174 "config_parser.h" +#line 176 "../../../lib/config/config_parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy index 765341b73..b00fc1284 100644 --- a/lib/config/config_parser.yy +++ b/lib/config/config_parser.yy @@ -78,6 +78,7 @@ using namespace icinga; %token T_TYPE_STRING "string (T_TYPE_STRING)" %token T_TYPE_SCALAR "scalar (T_TYPE_SCALAR)" %token T_TYPE_ANY "any (T_TYPE_ANY)" +%token T_TYPE_NAME "name (T_TYPE_NAME)" %token T_VALIDATOR "%validator (T_VALIDATOR)" %token T_REQUIRE "%require (T_REQUIRE)" %token T_ATTRIBUTE "%attribute (T_ATTRIBUTE)" @@ -246,14 +247,22 @@ typerule: T_REQUIRE T_STRING } | T_ATTRIBUTE type T_STRING { - TypeRule rule($2, $3, TypeRuleList::Ptr(), yylloc); + TypeRule rule($2, String(), $3, TypeRuleList::Ptr(), yylloc); free($3); m_RuleLists.top()->AddRule(rule); } + | T_ATTRIBUTE T_TYPE_NAME '(' identifier ')' T_STRING + { + TypeRule rule($2, $4, $6, TypeRuleList::Ptr(), yylloc); + free($4); + free($6); + + m_RuleLists.top()->AddRule(rule); + } | T_ATTRIBUTE type T_STRING typerulelist { - TypeRule rule($2, $3, *$4, yylloc); + TypeRule rule($2, String(), $3, *$4, yylloc); free($3); delete $4; m_RuleLists.top()->AddRule(rule); @@ -274,6 +283,7 @@ type: T_TYPE_DICTIONARY | T_TYPE_STRING | T_TYPE_SCALAR | T_TYPE_ANY + | T_TYPE_NAME { $$ = $1; } diff --git a/lib/config/configtype.cpp b/lib/config/configtype.cpp index f0639c1ae..fa8ed72b9 100644 --- a/lib/config/configtype.cpp +++ b/lib/config/configtype.cpp @@ -67,7 +67,8 @@ void ConfigType::ValidateItem(const ConfigItem::Ptr& item) const item->GetLinkedExpressionList()->Execute(attrs); std::vector locations; - locations.push_back("Object '" + item->GetName() + "' (Type: '" + item->GetType() + "')"); + DebugInfo debugInfo = item->GetDebugInfo(); + locations.push_back("Object '" + item->GetName() + "' (Type: '" + item->GetType() + "') at " + debugInfo.Path + ":" + Convert::ToString(debugInfo.FirstLine)); ConfigType::Ptr parent; if (m_Parent.IsEmpty()) { @@ -144,12 +145,13 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary, BOOST_FOREACH(boost::tie(key, value), dictionary) { TypeValidationResult overallResult = ValidationUnknownField; std::vector subRuleLists; + String hint; locations.push_back("Attribute '" + key + "'"); BOOST_FOREACH(const TypeRuleList::Ptr& ruleList, ruleLists) { TypeRuleList::Ptr subRuleList; - TypeValidationResult result = ruleList->ValidateAttribute(key, value, &subRuleList); + TypeValidationResult result = ruleList->ValidateAttribute(key, value, &subRuleList, &hint); if (subRuleList) subRuleLists.push_back(subRuleList); @@ -168,8 +170,14 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary, if (overallResult == ValidationUnknownField) ConfigCompilerContext::GetContext()->AddError(true, "Unknown attribute: " + LocationToString(locations)); - else if (overallResult == ValidationInvalidType) - ConfigCompilerContext::GetContext()->AddError(false, "Invalid type for attribute: " + LocationToString(locations)); + else if (overallResult == ValidationInvalidType) { + String message = "Invalid value for attribute: " + LocationToString(locations); + + if (!hint.IsEmpty()) + message += ": " + hint; + + ConfigCompilerContext::GetContext()->AddError(false, message); + } if (!subRuleLists.empty() && value.IsObjectType()) ValidateDictionary(value, subRuleLists, locations); @@ -223,12 +231,13 @@ void ConfigType::ValidateArray(const Array::Ptr& array, TypeValidationResult overallResult = ValidationUnknownField; std::vector subRuleLists; + String hint; - locations.push_back("Attribute '" + key + "'"); + locations.push_back("Index " + key); BOOST_FOREACH(const TypeRuleList::Ptr& ruleList, ruleLists) { TypeRuleList::Ptr subRuleList; - TypeValidationResult result = ruleList->ValidateAttribute(key, value, &subRuleList); + TypeValidationResult result = ruleList->ValidateAttribute(key, value, &subRuleList, &hint); if (subRuleList) subRuleLists.push_back(subRuleList); @@ -247,8 +256,14 @@ void ConfigType::ValidateArray(const Array::Ptr& array, if (overallResult == ValidationUnknownField) ConfigCompilerContext::GetContext()->AddError(true, "Unknown attribute: " + LocationToString(locations)); - else if (overallResult == ValidationInvalidType) - ConfigCompilerContext::GetContext()->AddError(false, "Invalid type for array index: " + LocationToString(locations)); + else if (overallResult == ValidationInvalidType) { + String message = "Invalid value for array index: " + LocationToString(locations); + + if (!hint.IsEmpty()) + message += ": " + hint; + + ConfigCompilerContext::GetContext()->AddError(false, message); + } if (!subRuleLists.empty() && value.IsObjectType()) ValidateDictionary(value, subRuleLists, locations); diff --git a/lib/config/typerule.cpp b/lib/config/typerule.cpp index f878a1767..314734962 100644 --- a/lib/config/typerule.cpp +++ b/lib/config/typerule.cpp @@ -18,6 +18,8 @@ ******************************************************************************/ #include "config/typerule.h" +#include "config/configitem.h" +#include "config/configcompilercontext.h" #include "base/convert.h" #include "base/utility.h" #include "base/dictionary.h" @@ -25,9 +27,10 @@ using namespace icinga; -TypeRule::TypeRule(TypeSpecifier type, const String& namePattern, - const TypeRuleList::Ptr& subRules, const DebugInfo& debuginfo) - : m_Type(type), m_NamePattern(namePattern), m_SubRules(subRules), m_DebugInfo(debuginfo) +TypeRule::TypeRule(TypeSpecifier type, const String& nameType, + const String& namePattern, const TypeRuleList::Ptr& subRules, + const DebugInfo& debuginfo) + : m_Type(type), m_NameType(nameType), m_NamePattern(namePattern), m_SubRules(subRules), m_DebugInfo(debuginfo) { } TypeRuleList::Ptr TypeRule::GetSubRules(void) const @@ -40,8 +43,11 @@ bool TypeRule::MatchName(const String& name) const return (Utility::Match(m_NamePattern, name)); } -bool TypeRule::MatchValue(const Value& value) const +bool TypeRule::MatchValue(const Value& value, String *hint) const { + ConfigCompilerContext *context; + ConfigItem::Ptr item; + if (value.IsEmpty()) return true; @@ -69,6 +75,25 @@ bool TypeRule::MatchValue(const Value& value) const case TypeArray: return value.IsObjectType(); + case TypeName: + if (!value.IsScalar()) + return false; + + context = ConfigCompilerContext::GetContext(); + + if (context) + item = context->GetItem(m_NameType, value); + + if (!item && (!context || (context->GetFlags() & CompilerLinkExisting))) + item = ConfigItem::GetObject(m_NameType, value); + + if (!item) { + *hint = "Object '" + value + "' of type '" + m_NameType + "' does not exist."; + return false; + } + + return true; + default: return false; } diff --git a/lib/config/typerule.h b/lib/config/typerule.h index c73243020..a4dfba6fc 100644 --- a/lib/config/typerule.h +++ b/lib/config/typerule.h @@ -39,7 +39,8 @@ enum TypeSpecifier TypeNumber, TypeString, TypeDictionary, - TypeArray + TypeArray, + TypeName }; /** @@ -50,16 +51,18 @@ enum TypeSpecifier struct I2_CONFIG_API TypeRule { public: - TypeRule(TypeSpecifier type, const String& namePattern, - const TypeRuleList::Ptr& subRules, const DebugInfo& debuginfo); + TypeRule(TypeSpecifier type, const String& nameType, + const String& namePattern, const TypeRuleList::Ptr& subRules, + const DebugInfo& debuginfo); TypeRuleList::Ptr GetSubRules(void) const; bool MatchName(const String& name) const; - bool MatchValue(const Value& value) const; + bool MatchValue(const Value& value, String *hint) const; private: TypeSpecifier m_Type; + String m_NameType; String m_NamePattern; TypeRuleList::Ptr m_SubRules; DebugInfo m_DebugInfo; diff --git a/lib/config/typerulelist.cpp b/lib/config/typerulelist.cpp index 504377f5d..29bdb933a 100644 --- a/lib/config/typerulelist.cpp +++ b/lib/config/typerulelist.cpp @@ -113,10 +113,11 @@ size_t TypeRuleList::GetLength(void) const * @param name The name of the attribute. * @param value The value of the attribute. * @param[out] subRules The list of sub-rules for the matching rule. + * @param[out] hint A hint describing the validation failure. * @returns The validation result. */ TypeValidationResult TypeRuleList::ValidateAttribute(const String& name, - const Value& value, TypeRuleList::Ptr *subRules) const + const Value& value, TypeRuleList::Ptr *subRules, String *hint) const { bool foundField = false; BOOST_FOREACH(const TypeRule& rule, m_Rules) { @@ -125,7 +126,7 @@ TypeValidationResult TypeRuleList::ValidateAttribute(const String& name, foundField = true; - if (rule.MatchValue(value)) { + if (rule.MatchValue(value, hint)) { *subRules = rule.GetSubRules(); return ValidationOK; } @@ -136,4 +137,3 @@ TypeValidationResult TypeRuleList::ValidateAttribute(const String& name, else return ValidationUnknownField; } - diff --git a/lib/config/typerulelist.h b/lib/config/typerulelist.h index 3cf205191..4bae5f528 100644 --- a/lib/config/typerulelist.h +++ b/lib/config/typerulelist.h @@ -60,7 +60,7 @@ public: void AddRule(const TypeRule& rule); void AddRules(const TypeRuleList::Ptr& ruleList); - TypeValidationResult ValidateAttribute(const String& name, const Value& value, TypeRuleList::Ptr *subRules) const; + TypeValidationResult ValidateAttribute(const String& name, const Value& value, TypeRuleList::Ptr *subRules, String *hint) const; size_t GetLength(void) const; diff --git a/lib/icinga/icinga-type.conf b/lib/icinga/icinga-type.conf index 09dba47e8..7d119586f 100644 --- a/lib/icinga/icinga-type.conf +++ b/lib/icinga/icinga-type.conf @@ -21,15 +21,15 @@ type Host { %attribute string "display_name", %attribute string "hostcheck", %attribute array "hostgroups" { - %attribute string "*" + %attribute name(HostGroup) "*" }, %attribute array "hostdependencies" { - %attribute string "*" + %attribute name(Host) "*" }, %attribute array "servicedependencies" { %attribute dictionary "*" { %require "host", - %attribute string "host", + %attribute name(Host) "host", %require "service", %attribute string "service" @@ -40,7 +40,7 @@ type Host { %attribute dictionary "*" { %attribute array "templates" { - %attribute string "*" + %attribute name(Service) "*" }, %attribute string "short_name", @@ -52,26 +52,26 @@ type Host { %attribute array "export_macros", - %attribute string "check_period", + %attribute name(TimePeriod) "check_period", %attribute number "check_interval", %attribute number "retry_interval", %attribute number "notification_interval", - %attribute string "notification_period", + %attribute name(TimePeriod) "notification_period", %attribute array "servicegroups" { - %attribute string "*" + %attribute name(ServiceGroup) "*" }, %attribute array "checkers" { %attribute string "*" }, %attribute array "hostdependencies" { - %attribute string "*" + %attribute name(Host) "*" }, %attribute array "servicedependencies" { %attribute dictionary "*" { %require "host", - %attribute string "host", + %attribute name(Host) "host", %require "service", %attribute string "service" @@ -81,20 +81,22 @@ type Host { %attribute dictionary "notifications" { %attribute dictionary "*" { %attribute array "templates" { - %attribute string "*" + %attribute name(Notification) "*" }, %attribute dictionary "macros" { %attribute string "*" }, - %attribute array "export_macros", - - %attribute array "users" { + %attribute array "export_macros" { %attribute string "*" }, + + %attribute array "users" { + %attribute name(User) "*" + }, %attribute array "groups" { - %attribute string "*" + %attribute name(UserGroup) "*" } } }, @@ -104,41 +106,45 @@ type Host { %attribute dictionary "notifications" { %attribute dictionary "*" { %attribute array "templates" { - %attribute string "*" + %attribute name(Notification) "*" }, %attribute dictionary "macros" { %attribute string "*" }, - %attribute array "export_macros", - - %attribute array "users" { + %attribute array "export_macros" { %attribute string "*" }, + + %attribute array "users" { + %attribute name(User) "*" + }, %attribute array "groups" { - %attribute string "*" + %attribute name(UserGroup) "*" } } }, /* service attributes */ %attribute number "max_check_attempts", - %attribute string "check_period", + %attribute name(TimePeriod) "check_period", %attribute number "check_interval", %attribute number "retry_interval", %attribute number "notification_interval", - %attribute string "notification_period", + %attribute name(TimePeriod) "notification_period", %attribute dictionary "macros" { %attribute string "*" }, - %attribute array "export_macros", + %attribute array "export_macros" { + %attribute string "*" + }, %attribute array "servicegroups" { - %attribute string "*" + %attribute name(ServiceGroup) "*" }, %attribute array "checkers" { %attribute string "*" @@ -158,7 +164,9 @@ type IcingaApplication { %attribute string "service", %attribute string "pid_path", %attribute string "state_path", - %attribute dictionary "macros" + %attribute dictionary "macros" { + %attribute string "*" + } } type Service { @@ -172,34 +180,36 @@ type Service { %attribute string "*" }, - %attribute array "export_macros", + %attribute array "export_macros" { + %attribute string "*" + }, %attribute array "check_command" { %attribute string "*" }, %attribute string "check_command", %attribute number "max_check_attempts", - %attribute string "check_period", + %attribute name(TimePeriod) "check_period", %attribute number "check_interval", %attribute number "retry_interval", %attribute number "notification_interval", - %attribute string "notification_period", + %attribute name(TimePeriod) "notification_period", %attribute array "hostdependencies" { - %attribute string "*" + %attribute name(Host) "*" }, %attribute array "servicedependencies" { %attribute dictionary "*" { %require "host", - %attribute string "host", + %attribute name(Host) "host", %require "service", %attribute string "service" } }, %attribute array "servicegroups" { - %attribute string "*" + %attribute name(ServiceGroup) "*" }, %attribute array "checkers" { %attribute string "*" @@ -214,20 +224,22 @@ type Service { %attribute dictionary "notifications" { %attribute dictionary "*" { %attribute array "templates" { - %attribute string "*" + %attribute name(Notification) "*" }, %attribute dictionary "macros" { %attribute string "*" }, - %attribute array "export_macros", - - %attribute array "users" { + %attribute array "export_macros" { %attribute string "*" }, + + %attribute array "users" { + %attribute name(User) "*" + }, %attribute array "groups" { - %attribute string "*" + %attribute name(UserGroup) "*" } } } @@ -254,13 +266,15 @@ type Notification { %attribute string "*" }, - %attribute array "export_macros", - - %attribute array "users" { + %attribute array "export_macros" { %attribute string "*" }, + + %attribute array "users" { + %attribute name(User) "*" + }, %attribute array "groups" { - %attribute string "*" + %attribute name(UserGroup) "*" }, %attribute array "notification_command" { @@ -269,7 +283,7 @@ type Notification { %attribute string "notification_command", %attribute number "notification_interval", - %attribute string "notification_period" + %attribute name(TimePeriod) "notification_period" } type User { @@ -280,7 +294,7 @@ type User { }, %attribute array "groups" { - %attribute string "*" + %attribute name(UserGroup) "*" } }