Unverified Commit bd831d0c authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #1015

Allow config keys to start with numbers
parents ab69cbd9 2bb962ac
......@@ -114,7 +114,7 @@ void read_ini_map(State& ps, Consumer&& consumer) {
state(await_key_name) {
transition(await_key_name, " \t\n")
fsm_epsilon(read_ini_comment(ps, consumer), await_key_name, ';')
transition(read_key_name, alphabetic_chars, key = ch)
transition(read_key_name, alphanumeric_chars, key = ch)
transition(done, '}', consumer.end_map())
}
// Reads a key of a "key=value" line.
......
......@@ -285,4 +285,56 @@ CAF_TEST(invalid inis) {
CAF_CHECK_EQUAL(parse(ini3), ini3_log);
}
CAF_TEST(integer keys are legal in INI syntax) {
static constexpr string_view ini = R"__(
[foo.bar]
1 = 10
2 = 20
)__";
// clang-format off
auto log = make_log(
"key: foo",
"{",
"key: bar",
"{",
"key: 1",
"value (integer): 10",
"key: 2",
"value (integer): 20",
"}",
"}"
);
// clang-format on
CAF_CHECK_EQUAL(parse(ini), log);
}
CAF_TEST(integer keys are legal in config syntax) {
static constexpr string_view ini = R"__(
foo {
bar {
1 = 10
2 = 20
}
}
)__";
// clang-format off
auto log = make_log(
"key: global",
"{",
"key: foo",
"{",
"key: bar",
"{",
"key: 1",
"value (integer): 10",
"key: 2",
"value (integer): 20",
"}",
"}",
"}"
);
// clang-format on
CAF_CHECK_EQUAL(parse(ini), log);
}
CAF_TEST_FIXTURE_SCOPE_END()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment