summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-11-20 00:47:22 +0100
committerHaru <haru@dotalux.com>2016-11-20 18:10:47 +0100
commitc12429cd00ce531b2ff685c201d74e2576c2a4aa (patch)
tree085bcf17d42535c93083dba8f5870c2223684fd6
parent149a531652da670c3f9c796d73e17b5a985383c1 (diff)
downloadhercules-c12429cd00ce531b2ff685c201d74e2576c2a4aa.tar.gz
hercules-c12429cd00ce531b2ff685c201d74e2576c2a4aa.tar.bz2
hercules-c12429cd00ce531b2ff685c201d74e2576c2a4aa.tar.xz
hercules-c12429cd00ce531b2ff685c201d74e2576c2a4aa.zip
Removed support for apostrophes in libconfig key names
The apostrophe (`'`) is no longer an allowed symbol in libconfig key names. It is no longer necessary since it is no longer allowed in constant names. Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--3rdparty/libconfig/extra/gen/scanner.l2
-rw-r--r--3rdparty/libconfig/scanner.c144
-rw-r--r--src/test/test_libconfig.c26
3 files changed, 90 insertions, 82 deletions
diff --git a/3rdparty/libconfig/extra/gen/scanner.l b/3rdparty/libconfig/extra/gen/scanner.l
index f717ac273..60ede1ca7 100644
--- a/3rdparty/libconfig/extra/gen/scanner.l
+++ b/3rdparty/libconfig/extra/gen/scanner.l
@@ -88,7 +88,7 @@ static unsigned long long fromhex(const char *s)
true [Tt][Rr][Uu][Ee]
false [Ff][Aa][Ll][Ss][Ee]
-name [A-Za-z0-9\*][-A-Za-z0-9_\*'.]*
+name [A-Za-z0-9\*][-A-Za-z0-9_\*.]*
integer [-+]?[0-9]+
integer64 [-+]?[0-9]+L(L)?
hex 0[Xx][0-9A-Fa-f]+
diff --git a/3rdparty/libconfig/scanner.c b/3rdparty/libconfig/scanner.c
index cfdd02ccf..8ed08f9b8 100644
--- a/3rdparty/libconfig/scanner.c
+++ b/3rdparty/libconfig/scanner.c
@@ -383,17 +383,17 @@ static const YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 4, 5, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 1, 6, 7, 1, 1, 1, 8, 9,
- 10, 11, 12, 13, 14, 15, 16, 17, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 19, 20, 21,
- 22, 23, 1, 24, 25, 26, 26, 26, 27, 28,
- 29, 29, 29, 29, 29, 30, 29, 29, 29, 29,
- 29, 31, 32, 33, 34, 29, 29, 35, 29, 29,
- 36, 37, 38, 1, 8, 1, 25, 26, 39, 40,
-
- 41, 42, 29, 29, 43, 29, 29, 44, 29, 45,
- 29, 29, 29, 46, 32, 47, 48, 29, 29, 35,
- 29, 29, 49, 1, 50, 1, 1, 1, 1, 1,
+ 1, 2, 1, 6, 7, 1, 1, 1, 1, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 18, 19, 20,
+ 21, 22, 1, 23, 24, 25, 25, 25, 26, 27,
+ 28, 28, 28, 28, 28, 29, 28, 28, 28, 28,
+ 28, 30, 31, 32, 33, 28, 28, 34, 28, 28,
+ 35, 36, 37, 1, 38, 1, 24, 25, 39, 40,
+
+ 41, 42, 28, 28, 43, 28, 28, 44, 28, 45,
+ 28, 28, 28, 46, 31, 47, 48, 28, 28, 34,
+ 28, 28, 49, 1, 50, 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,
@@ -412,10 +412,10 @@ static const YY_CHAR yy_ec[256] =
static const YY_CHAR yy_meta[51] =
{ 0,
- 1, 1, 1, 1, 1, 2, 1, 3, 1, 1,
- 3, 1, 1, 3, 3, 1, 4, 4, 1, 1,
- 1, 1, 1, 1, 4, 4, 4, 4, 3, 3,
- 3, 3, 3, 3, 3, 1, 2, 1, 4, 4,
+ 1, 1, 1, 1, 1, 2, 1, 1, 1, 3,
+ 1, 1, 3, 3, 1, 4, 4, 1, 1, 1,
+ 1, 1, 1, 4, 4, 4, 4, 3, 3, 3,
+ 3, 3, 3, 3, 1, 2, 1, 3, 4, 4,
4, 4, 3, 3, 3, 3, 3, 3, 1, 1
} ;
@@ -423,19 +423,19 @@ static const flex_int16_t yy_base[134] =
{ 0,
0, 49, 49, 50, 48, 49, 50, 51, 244, 243,
248, 251, 245, 251, 251, 251, 243, 251, 251, 0,
- 47, 251, 41, 55, 62, 210, 251, 251, 238, 218,
- 32, 251, 251, 251, 251, 67, 199, 251, 251, 225,
- 0, 251, 64, 0, 251, 61, 234, 216, 236, 234,
- 251, 0, 66, 87, 95, 106, 251, 233, 98, 200,
- 115, 204, 123, 251, 46, 47, 70, 190, 187, 251,
+ 47, 251, 49, 52, 54, 211, 251, 251, 238, 219,
+ 28, 251, 251, 251, 251, 71, 199, 251, 251, 226,
+ 0, 251, 63, 0, 251, 70, 234, 217, 236, 234,
+ 251, 0, 75, 86, 97, 108, 251, 233, 113, 201,
+ 115, 205, 139, 251, 49, 48, 75, 190, 187, 251,
0, 251, 0, 251, 251, 251, 251, 251, 0, 251,
- 251, 219, 198, 251, 117, 142, 166, 57, 113, 120,
- 154, 125, 128, 135, 0, 165, 162, 128, 154, 0,
+ 251, 225, 202, 251, 117, 124, 191, 101, 128, 131,
+ 157, 133, 135, 143, 0, 156, 152, 63, 138, 0,
- 156, 163, 161, 251, 167, 169, 171, 152, 149, 0,
- 126, 251, 174, 0, 0, 119, 117, 85, 119, 94,
- 251, 251, 197, 201, 205, 209, 213, 215, 219, 223,
- 227, 115, 104
+ 145, 171, 159, 251, 173, 175, 177, 140, 81, 0,
+ 123, 251, 179, 0, 0, 105, 96, 79, 109, 140,
+ 251, 251, 196, 200, 204, 208, 212, 214, 218, 222,
+ 226, 78, 75
} ;
static const flex_int16_t yy_def[134] =
@@ -459,32 +459,32 @@ static const flex_int16_t yy_def[134] =
static const flex_int16_t yy_nxt[302] =
{ 0,
- 12, 13, 14, 15, 15, 16, 17, 12, 18, 19,
- 20, 21, 22, 21, 23, 24, 25, 26, 27, 28,
- 29, 27, 12, 12, 20, 20, 20, 30, 20, 20,
- 20, 20, 31, 20, 20, 32, 12, 33, 20, 20,
+ 12, 13, 14, 15, 15, 16, 17, 18, 19, 20,
+ 21, 22, 21, 23, 24, 25, 26, 27, 28, 29,
+ 27, 12, 12, 20, 20, 20, 30, 20, 20, 20,
+ 20, 31, 20, 20, 32, 12, 33, 12, 20, 20,
20, 30, 20, 20, 20, 20, 31, 20, 34, 35,
- 36, 39, 39, 42, 42, 45, 45, 55, 55, 40,
- 40, 53, 66, 54, 54, 57, 80, 56, 67, 72,
- 58, 67, 37, 89, 89, 97, 59, 66, 60, 60,
- 98, 56, 55, 55, 43, 43, 46, 46, 61, 97,
- 68, 62, 56, 68, 98, 120, 63, 81, 73, 121,
-
- 74, 85, 61, 54, 54, 75, 56, 112, 76, 77,
- 78, 55, 55, 86, 90, 90, 87, 88, 100, 88,
- 120, 56, 89, 89, 91, 119, 92, 86, 93, 89,
- 89, 94, 94, 101, 101, 56, 90, 90, 91, 96,
- 96, 103, 103, 102, 94, 94, 91, 96, 96, 96,
- 96, 94, 94, 92, 110, 92, 118, 102, 103, 103,
- 91, 96, 96, 96, 96, 105, 117, 106, 110, 116,
- 107, 107, 101, 101, 105, 115, 105, 103, 103, 113,
- 113, 114, 102, 113, 113, 107, 107, 107, 107, 115,
- 113, 113, 111, 109, 108, 104, 102, 38, 38, 38,
-
- 38, 41, 41, 41, 41, 44, 44, 44, 44, 47,
- 47, 47, 47, 50, 50, 50, 50, 52, 52, 71,
- 122, 71, 71, 79, 83, 79, 79, 82, 82, 82,
- 82, 99, 69, 95, 52, 51, 51, 49, 84, 83,
+ 36, 39, 39, 42, 42, 45, 45, 66, 40, 40,
+ 53, 57, 54, 54, 55, 55, 58, 59, 72, 60,
+ 60, 37, 67, 66, 56, 80, 67, 97, 112, 61,
+ 98, 100, 62, 43, 43, 46, 46, 63, 110, 56,
+ 55, 55, 97, 68, 61, 98, 73, 68, 74, 85,
+
+ 56, 54, 54, 110, 75, 81, 115, 76, 77, 78,
+ 120, 86, 55, 55, 87, 56, 89, 89, 88, 119,
+ 88, 115, 56, 89, 89, 92, 86, 93, 90, 90,
+ 94, 94, 101, 101, 92, 118, 92, 56, 91, 103,
+ 103, 120, 102, 89, 89, 121, 90, 90, 103, 103,
+ 94, 94, 117, 91, 96, 96, 91, 102, 94, 94,
+ 101, 101, 96, 96, 96, 96, 116, 105, 114, 106,
+ 102, 91, 107, 107, 103, 103, 111, 96, 96, 96,
+ 96, 105, 109, 105, 108, 102, 113, 113, 113, 113,
+ 107, 107, 107, 107, 113, 113, 38, 38, 38, 38,
+
+ 41, 41, 41, 41, 44, 44, 44, 44, 47, 47,
+ 47, 47, 50, 50, 50, 50, 52, 52, 71, 104,
+ 71, 71, 79, 122, 79, 79, 82, 82, 82, 82,
+ 83, 99, 69, 95, 52, 51, 51, 49, 84, 83,
70, 69, 65, 64, 52, 51, 49, 122, 48, 48,
11, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
@@ -502,27 +502,27 @@ static const flex_int16_t yy_chk[302] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 3, 4, 5, 6, 7, 8, 23, 23, 3,
- 4, 21, 31, 21, 21, 24, 46, 23, 36, 43,
- 24, 67, 2, 88, 88, 65, 25, 31, 25, 25,
- 66, 23, 53, 53, 5, 6, 7, 8, 25, 65,
- 36, 25, 53, 67, 66, 120, 25, 46, 43, 120,
-
- 43, 54, 25, 54, 54, 43, 53, 133, 43, 43,
- 43, 55, 55, 54, 59, 59, 54, 56, 132, 56,
- 119, 55, 56, 56, 59, 118, 61, 54, 61, 89,
- 89, 61, 61, 85, 85, 55, 90, 90, 59, 63,
- 63, 92, 92, 85, 93, 93, 90, 63, 63, 63,
- 63, 94, 94, 86, 98, 86, 117, 85, 86, 86,
- 90, 63, 63, 63, 63, 91, 116, 91, 98, 111,
- 91, 91, 101, 101, 102, 109, 102, 103, 103, 102,
- 102, 108, 101, 105, 105, 106, 106, 107, 107, 109,
- 113, 113, 99, 97, 96, 87, 101, 123, 123, 123,
-
- 123, 124, 124, 124, 124, 125, 125, 125, 125, 126,
- 126, 126, 126, 127, 127, 127, 127, 128, 128, 129,
- 83, 129, 129, 130, 82, 130, 130, 131, 131, 131,
- 131, 69, 68, 62, 60, 58, 50, 49, 48, 47,
+ 2, 3, 4, 5, 6, 7, 8, 31, 3, 4,
+ 21, 24, 21, 21, 23, 23, 24, 25, 43, 25,
+ 25, 2, 36, 31, 23, 46, 67, 65, 133, 25,
+ 66, 132, 25, 5, 6, 7, 8, 25, 98, 23,
+ 53, 53, 65, 36, 25, 66, 43, 67, 43, 54,
+
+ 53, 54, 54, 98, 43, 46, 109, 43, 43, 43,
+ 119, 54, 55, 55, 54, 53, 88, 88, 56, 118,
+ 56, 109, 55, 56, 56, 61, 54, 61, 59, 59,
+ 61, 61, 85, 85, 86, 117, 86, 55, 59, 86,
+ 86, 120, 85, 89, 89, 120, 90, 90, 92, 92,
+ 93, 93, 116, 59, 63, 63, 90, 85, 94, 94,
+ 101, 101, 63, 63, 63, 63, 111, 91, 108, 91,
+ 101, 90, 91, 91, 103, 103, 99, 63, 63, 63,
+ 63, 102, 97, 102, 96, 101, 102, 102, 105, 105,
+ 106, 106, 107, 107, 113, 113, 123, 123, 123, 123,
+
+ 124, 124, 124, 124, 125, 125, 125, 125, 126, 126,
+ 126, 126, 127, 127, 127, 127, 128, 128, 129, 87,
+ 129, 129, 130, 83, 130, 130, 131, 131, 131, 131,
+ 82, 69, 68, 62, 60, 58, 50, 49, 48, 47,
40, 37, 30, 29, 26, 17, 13, 11, 10, 9,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
diff --git a/src/test/test_libconfig.c b/src/test/test_libconfig.c
index 639cf64e8..e1a767195 100644
--- a/src/test/test_libconfig.c
+++ b/src/test/test_libconfig.c
@@ -691,19 +691,22 @@ static const char *test_libconfig_setting_names(void)
struct config_t config;
int32 i32;
const char *input = "/* Test File */\n"
- "Setting'with'apostrophes: 1;\n"
+ "1st_setting_with_numbers: 1;\n"
"Setting.with.periods: 2;\n"
"Setting: {\n"
" with: {\n"
" periods: 3;\n"
+ " 2nested: {\n"
+ " numbers1: 4;\n"
+ " };\n"
" };\n"
" nested: {\n"
" in: {\n"
- " groups: 4;\n"
+ " groups: 5;\n"
" };\n"
" };\n"
"};\n"
- "1st_setting_with_numbers: 5;\n"
+ "Setting_with_2_numbers_000: 6;\n"
"/* End test file */\n";
libconfig->init(&config);
@@ -713,9 +716,9 @@ static const char *test_libconfig_setting_names(void)
return "Unable to parse configuration.";
}
- if (libconfig->lookup_int(&config, "Setting'with'apostrophes", &i32) == CONFIG_FALSE || i32 != 1) {
+ if (libconfig->lookup_int(&config, "1st_setting_with_numbers", &i32) == CONFIG_FALSE || i32 != 1) {
libconfig->destroy(&config);
- return "Setting'with'apostrophes failed.";
+ return "1st_setting_with_numbers failed.";
}
if (libconfig->lookup_int(&config, "Setting.with.periods", &i32) == CONFIG_FALSE || i32 != 2) {
@@ -728,19 +731,24 @@ static const char *test_libconfig_setting_names(void)
return "Setting:with:periods failed.";
}
- if (libconfig->lookup_int(&config, "Setting:nested:in:groups", &i32) == CONFIG_FALSE || i32 != 4) {
+ if (libconfig->lookup_int(&config, "Setting/with/2nested/numbers1", &i32) == CONFIG_FALSE || i32 != 4) {
+ libconfig->destroy(&config);
+ return "Setting/with/2nested/numbers1 failed.";
+ }
+
+ if (libconfig->lookup_int(&config, "Setting:nested:in:groups", &i32) == CONFIG_FALSE || i32 != 5) {
libconfig->destroy(&config);
return "Setting:nested:in:groups failed.";
}
- if (libconfig->lookup_int(&config, "Setting/nested/in/groups", &i32) == CONFIG_FALSE || i32 != 4) {
+ if (libconfig->lookup_int(&config, "Setting/nested/in/groups", &i32) == CONFIG_FALSE || i32 != 5) {
libconfig->destroy(&config);
return "Setting/nested/in/groups failed.";
}
- if (libconfig->lookup_int(&config, "1st_setting_with_numbers", &i32) == CONFIG_FALSE || i32 != 5) {
+ if (libconfig->lookup_int(&config, "Setting_with_2_numbers_000", &i32) == CONFIG_FALSE || i32 != 6) {
libconfig->destroy(&config);
- return "1st_setting_with_numbers failed.";
+ return "Setting_with_2_numbers_000 failed.";
}
libconfig->destroy(&config);