summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-10-05 07:01:54 +0200
committerHaru <haru@dotalux.com>2013-10-05 07:01:54 +0200
commit62c5e65d28833c1068d195778c0e3a710acaa104 (patch)
treea8f19710375f669530d5640a14c1e3575dad32a0
parentdedec165eaeb0d291279b1d5b53fac242bcf7b4c (diff)
downloadhercules-62c5e65d28833c1068d195778c0e3a710acaa104.tar.gz
hercules-62c5e65d28833c1068d195778c0e3a710acaa104.tar.bz2
hercules-62c5e65d28833c1068d195778c0e3a710acaa104.tar.xz
hercules-62c5e65d28833c1068d195778c0e3a710acaa104.zip
Added support for trailing commas within libconfig arrays
- A trailing comma in conf/plugins.conf will no longer cause a parse error. This makes it easier to comment out plugins to disable them. - conf/plugins.conf has been updated to reflect this change. Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--3rdparty/libconfig/extra/gen/grammar.y13
-rw-r--r--3rdparty/libconfig/grammar.c182
-rw-r--r--conf/plugins.conf10
3 files changed, 111 insertions, 94 deletions
diff --git a/3rdparty/libconfig/extra/gen/grammar.y b/3rdparty/libconfig/extra/gen/grammar.y
index f578897cb..576241c01 100644
--- a/3rdparty/libconfig/extra/gen/grammar.y
+++ b/3rdparty/libconfig/extra/gen/grammar.y
@@ -118,6 +118,11 @@ setting_terminator:
| TOK_COMMA
;
+comma_optional:
+ /* empty */
+ | TOK_COMMA
+ ;
+
setting:
TOK_NAME
{
@@ -359,9 +364,13 @@ value_list_optional:
| value_list
;
-simple_value_list:
+simple_value_list_sub:
simple_value
- | simple_value_list TOK_COMMA simple_value
+ | simple_value_list_sub TOK_COMMA simple_value
+ ;
+
+simple_value_list:
+ simple_value_list_sub comma_optional
;
simple_value_list_optional:
diff --git a/3rdparty/libconfig/grammar.c b/3rdparty/libconfig/grammar.c
index 0331c1854..47fb7b5dd 100644
--- a/3rdparty/libconfig/grammar.c
+++ b/3rdparty/libconfig/grammar.c
@@ -445,16 +445,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 6
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 35
+#define YYLAST 36
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 23
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 20
+#define YYNNTS 22
/* YYNRULES -- Number of rules. */
-#define YYNRULES 39
+#define YYNRULES 42
/* YYNRULES -- Number of states. */
-#define YYNSTATES 47
+#define YYNSTATES 49
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -502,32 +502,35 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 4, 6, 8, 11, 12, 14, 15,
- 17, 19, 20, 26, 27, 32, 33, 38, 40, 42,
- 44, 46, 48, 51, 53, 55, 57, 59, 61, 63,
- 65, 67, 71, 72, 74, 76, 80, 81, 83, 84
+ 17, 19, 20, 22, 23, 29, 30, 35, 36, 41,
+ 43, 45, 47, 49, 51, 54, 56, 58, 60, 62,
+ 64, 66, 68, 70, 74, 75, 77, 79, 83, 86,
+ 87, 89, 90
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 24, 0, -1, -1, 25, -1, 28, -1, 25, 28,
+ 24, 0, -1, -1, 25, -1, 29, -1, 25, 29,
-1, -1, 25, -1, -1, 20, -1, 17, -1, -1,
- 10, 29, 11, 34, 27, -1, -1, 13, 31, 40,
- 14, -1, -1, 15, 33, 38, 16, -1, 36, -1,
- 30, -1, 32, -1, 41, -1, 9, -1, 35, 9,
- -1, 3, -1, 4, -1, 6, -1, 5, -1, 7,
- -1, 8, -1, 35, -1, 34, -1, 37, 17, 34,
- -1, -1, 37, -1, 36, -1, 39, 17, 36, -1,
- -1, 39, -1, -1, 18, 42, 26, 19, -1
+ 17, -1, -1, 10, 30, 11, 35, 27, -1, -1,
+ 13, 32, 42, 14, -1, -1, 15, 34, 39, 16,
+ -1, 37, -1, 31, -1, 33, -1, 43, -1, 9,
+ -1, 36, 9, -1, 3, -1, 4, -1, 6, -1,
+ 5, -1, 7, -1, 8, -1, 36, -1, 35, -1,
+ 38, 17, 35, -1, -1, 38, -1, 37, -1, 40,
+ 17, 37, -1, 40, 28, -1, -1, 41, -1, -1,
+ 18, 44, 26, 19, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 100, 100, 102, 106, 107, 110, 112, 115, 117,
- 118, 123, 122, 142, 141, 165, 164, 187, 188, 189,
- 190, 194, 195, 199, 219, 241, 263, 285, 307, 325,
- 353, 354, 357, 359, 363, 364, 367, 369, 374, 373
+ 118, 121, 123, 128, 127, 147, 146, 170, 169, 192,
+ 193, 194, 195, 199, 200, 204, 224, 246, 268, 290,
+ 312, 330, 358, 359, 362, 364, 368, 369, 373, 376,
+ 378, 383, 382
};
#endif
@@ -542,9 +545,10 @@ static const char *const yytname[] =
"TOK_LIST_START", "TOK_LIST_END", "TOK_COMMA", "TOK_GROUP_START",
"TOK_GROUP_END", "TOK_SEMICOLON", "TOK_GARBAGE", "TOK_ERROR", "$accept",
"configuration", "setting_list", "setting_list_optional",
- "setting_terminator", "setting", "$@1", "array", "$@2", "list", "$@3",
- "value", "string", "simple_value", "value_list", "value_list_optional",
- "simple_value_list", "simple_value_list_optional", "group", "$@4", 0
+ "setting_terminator", "comma_optional", "setting", "$@1", "array", "$@2",
+ "list", "$@3", "value", "string", "simple_value", "value_list",
+ "value_list_optional", "simple_value_list_sub", "simple_value_list",
+ "simple_value_list_optional", "group", "$@4", 0
};
#endif
@@ -563,18 +567,20 @@ static const yytype_uint16 yytoknum[] =
static const yytype_uint8 yyr1[] =
{
0, 23, 24, 24, 25, 25, 26, 26, 27, 27,
- 27, 29, 28, 31, 30, 33, 32, 34, 34, 34,
- 34, 35, 35, 36, 36, 36, 36, 36, 36, 36,
- 37, 37, 38, 38, 39, 39, 40, 40, 42, 41
+ 27, 28, 28, 30, 29, 32, 31, 34, 33, 35,
+ 35, 35, 35, 36, 36, 37, 37, 37, 37, 37,
+ 37, 37, 38, 38, 39, 39, 40, 40, 41, 42,
+ 42, 44, 43
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 1, 1, 2, 0, 1, 0, 1,
- 1, 0, 5, 0, 4, 0, 4, 1, 1, 1,
- 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 3, 0, 1, 1, 3, 0, 1, 0, 4
+ 1, 0, 1, 0, 5, 0, 4, 0, 4, 1,
+ 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 3, 0, 1, 1, 3, 2, 0,
+ 1, 0, 4
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -582,18 +588,19 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 11, 0, 3, 4, 0, 1, 5, 0, 23,
- 24, 26, 25, 27, 28, 21, 13, 15, 38, 18,
- 19, 8, 29, 17, 20, 36, 32, 6, 10, 9,
- 12, 22, 34, 37, 0, 30, 33, 0, 7, 0,
- 0, 14, 0, 16, 39, 35, 31
+ 2, 13, 0, 3, 4, 0, 1, 5, 0, 25,
+ 26, 28, 27, 29, 30, 23, 15, 17, 41, 20,
+ 21, 8, 31, 19, 22, 39, 34, 6, 10, 9,
+ 14, 24, 36, 11, 40, 0, 32, 35, 0, 7,
+ 0, 12, 38, 16, 0, 18, 42, 37, 33
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 2, 3, 39, 30, 4, 5, 19, 25, 20,
- 26, 21, 22, 23, 36, 37, 33, 34, 24, 27
+ -1, 2, 3, 40, 30, 42, 4, 5, 19, 25,
+ 20, 26, 21, 22, 23, 37, 38, 33, 34, 35,
+ 24, 27
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
@@ -601,18 +608,19 @@ static const yytype_int8 yydefgoto[] =
#define YYPACT_NINF -26
static const yytype_int8 yypact[] =
{
- -8, -26, 12, -8, -26, 5, -26, -26, 0, -26,
+ -7, -26, 4, -7, -26, 1, -26, -26, 2, -26,
-26, -26, -26, -26, -26, -26, -26, -26, -26, -26,
- -26, -6, 10, -26, -26, 23, 0, -8, -26, -26,
- -26, -26, -26, 3, 7, -26, 6, 8, -8, 14,
- 23, -26, 0, -26, -26, -26, -26
+ -26, -4, 5, -26, -26, 18, 2, -7, -26, -26,
+ -26, -26, -26, 11, -26, 15, -26, 13, 16, -7,
+ 12, 18, -26, -26, 2, -26, -26, -26, -26
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -26, -26, -5, -26, -26, -3, -26, -26, -26, -26,
- -26, -25, -26, -15, -26, -26, -26, -26, -26, -26
+ -26, -26, 6, -26, -26, -26, -3, -26, -26, -26,
+ -26, -26, -25, -26, -23, -26, -26, -26, -26, -26,
+ -26, -26
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -622,29 +630,29 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 7, 35, 1, 9, 10, 11, 12, 13, 14, 15,
- 32, 28, 6, 16, 29, 17, 8, 46, 18, 31,
- 40, 41, 38, 42, 43, 45, 9, 10, 11, 12,
- 13, 14, 15, 44, 0, 7
+ 7, 36, 32, 1, 6, 9, 10, 11, 12, 13,
+ 14, 15, 8, 28, 31, 16, 29, 17, 47, 48,
+ 18, 9, 10, 11, 12, 13, 14, 15, 41, 43,
+ 44, 46, 45, 39, 0, 0, 7
};
static const yytype_int8 yycheck[] =
{
- 3, 26, 10, 3, 4, 5, 6, 7, 8, 9,
- 25, 17, 0, 13, 20, 15, 11, 42, 18, 9,
- 17, 14, 27, 17, 16, 40, 3, 4, 5, 6,
- 7, 8, 9, 19, -1, 38
+ 3, 26, 25, 10, 0, 3, 4, 5, 6, 7,
+ 8, 9, 11, 17, 9, 13, 20, 15, 41, 44,
+ 18, 3, 4, 5, 6, 7, 8, 9, 17, 14,
+ 17, 19, 16, 27, -1, -1, 39
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 10, 24, 25, 28, 29, 0, 28, 11, 3,
- 4, 5, 6, 7, 8, 9, 13, 15, 18, 30,
- 32, 34, 35, 36, 41, 31, 33, 42, 17, 20,
- 27, 9, 36, 39, 40, 34, 37, 38, 25, 26,
- 17, 14, 17, 16, 19, 36, 34
+ 0, 10, 24, 25, 29, 30, 0, 29, 11, 3,
+ 4, 5, 6, 7, 8, 9, 13, 15, 18, 31,
+ 33, 35, 36, 37, 43, 32, 34, 44, 17, 20,
+ 27, 9, 37, 40, 41, 42, 35, 38, 39, 25,
+ 26, 17, 28, 14, 17, 16, 19, 37, 35
};
#define yyerrok (yyerrstatus = 0)
@@ -1483,10 +1491,10 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 11:
+ case 13:
/* Line 1464 of yacc.c */
-#line 123 "grammar.y"
+#line 128 "grammar.y"
{
ctx->setting = config_setting_add(ctx->parent, (yyvsp[(1) - (1)].sval), CONFIG_TYPE_NONE);
@@ -1502,10 +1510,10 @@ yyreduce:
}
break;
- case 13:
+ case 15:
/* Line 1464 of yacc.c */
-#line 142 "grammar.y"
+#line 147 "grammar.y"
{
if(IN_LIST())
{
@@ -1521,20 +1529,20 @@ yyreduce:
}
break;
- case 14:
+ case 16:
/* Line 1464 of yacc.c */
-#line 157 "grammar.y"
+#line 162 "grammar.y"
{
if(ctx->parent)
ctx->parent = ctx->parent->parent;
}
break;
- case 15:
+ case 17:
/* Line 1464 of yacc.c */
-#line 165 "grammar.y"
+#line 170 "grammar.y"
{
if(IN_LIST())
{
@@ -1550,34 +1558,34 @@ yyreduce:
}
break;
- case 16:
+ case 18:
/* Line 1464 of yacc.c */
-#line 180 "grammar.y"
+#line 185 "grammar.y"
{
if(ctx->parent)
ctx->parent = ctx->parent->parent;
}
break;
- case 21:
+ case 23:
/* Line 1464 of yacc.c */
-#line 194 "grammar.y"
+#line 199 "grammar.y"
{ parsectx_append_string(ctx, (yyvsp[(1) - (1)].sval)); free((yyvsp[(1) - (1)].sval)); }
break;
- case 22:
+ case 24:
/* Line 1464 of yacc.c */
-#line 195 "grammar.y"
+#line 200 "grammar.y"
{ parsectx_append_string(ctx, (yyvsp[(2) - (2)].sval)); free((yyvsp[(2) - (2)].sval)); }
break;
- case 23:
+ case 25:
/* Line 1464 of yacc.c */
-#line 200 "grammar.y"
+#line 205 "grammar.y"
{
if(IN_ARRAY() || IN_LIST())
{
@@ -1599,10 +1607,10 @@ yyreduce:
}
break;
- case 24:
+ case 26:
/* Line 1464 of yacc.c */
-#line 220 "grammar.y"
+#line 225 "grammar.y"
{
if(IN_ARRAY() || IN_LIST())
{
@@ -1626,10 +1634,10 @@ yyreduce:
}
break;
- case 25:
+ case 27:
/* Line 1464 of yacc.c */
-#line 242 "grammar.y"
+#line 247 "grammar.y"
{
if(IN_ARRAY() || IN_LIST())
{
@@ -1653,10 +1661,10 @@ yyreduce:
}
break;
- case 26:
+ case 28:
/* Line 1464 of yacc.c */
-#line 264 "grammar.y"
+#line 269 "grammar.y"
{
if(IN_ARRAY() || IN_LIST())
{
@@ -1680,10 +1688,10 @@ yyreduce:
}
break;
- case 27:
+ case 29:
/* Line 1464 of yacc.c */
-#line 286 "grammar.y"
+#line 291 "grammar.y"
{
if(IN_ARRAY() || IN_LIST())
{
@@ -1707,10 +1715,10 @@ yyreduce:
}
break;
- case 28:
+ case 30:
/* Line 1464 of yacc.c */
-#line 308 "grammar.y"
+#line 313 "grammar.y"
{
if(IN_ARRAY() || IN_LIST())
{
@@ -1730,10 +1738,10 @@ yyreduce:
}
break;
- case 29:
+ case 31:
/* Line 1464 of yacc.c */
-#line 326 "grammar.y"
+#line 331 "grammar.y"
{
if(IN_ARRAY() || IN_LIST())
{
@@ -1760,10 +1768,10 @@ yyreduce:
}
break;
- case 38:
+ case 41:
/* Line 1464 of yacc.c */
-#line 374 "grammar.y"
+#line 383 "grammar.y"
{
if(IN_LIST())
{
@@ -1779,10 +1787,10 @@ yyreduce:
}
break;
- case 39:
+ case 42:
/* Line 1464 of yacc.c */
-#line 389 "grammar.y"
+#line 398 "grammar.y"
{
if(ctx->parent)
ctx->parent = ctx->parent->parent;
@@ -1792,7 +1800,7 @@ yyreduce:
/* Line 1464 of yacc.c */
-#line 1796 "grammar.c"
+#line 1804 "grammar.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2004,6 +2012,6 @@ yyreturn:
/* Line 1684 of yacc.c */
-#line 395 "grammar.y"
+#line 404 "grammar.y"
diff --git a/conf/plugins.conf b/conf/plugins.conf
index c88a4fb50..d9bd7e386 100644
--- a/conf/plugins.conf
+++ b/conf/plugins.conf
@@ -23,16 +23,16 @@ you need to put in a comma, to separate the plugins.
-----------------------------------------
plugins_list: [
"example",
- "other"
+ "other",
]
-----------------------------------------
Please note that your scripts need to be saved
in the .c (source code) extension and placed in the /src/plugin/ folder.
-----------------------------------------
*/
-plugins_list:[
- "HPMHooking"
+plugins_list: [
+ "HPMHooking",
//"db2sql",
//"sample",
- //"other"
-] \ No newline at end of file
+ //"other",
+]