formats.libconfig: add support for dashes (#359308)
This commit is contained in:
commit
12cadcb077
@ -24,7 +24,7 @@ fn validate_setting_name(key: &str) -> bool {
|
||||
(first_char.is_alphabetic() || first_char == '*')
|
||||
&& key[1..]
|
||||
.chars()
|
||||
.all(|c| c.is_alphanumeric() || c == '_' || c == '*')
|
||||
.all(|c| c.is_alphanumeric() || c == '_' || c == '*' || c == '-')
|
||||
}
|
||||
|
||||
const SPECIAL_TYPES: [&str; 5] = ["octal", "hex", "float", "list", "array"];
|
||||
|
@ -14,6 +14,9 @@ let
|
||||
simple_top_level_attr = "1.0";
|
||||
nested.attrset.has.a.integer.value = 100;
|
||||
some_floaty = 29.95;
|
||||
## dashes in key names
|
||||
top-level-dash = "pass";
|
||||
nested.level-dash = "pass";
|
||||
## Same syntax here on these two, but they should get serialized differently:
|
||||
# > A list may have zero or more elements, each of which can be a scalar value, an array, a group, or another list.
|
||||
list1d = libconfig.lib.mkList [ 1 "mixed!" 5 2 ];
|
||||
|
@ -1,6 +1,6 @@
|
||||
array1d=[1, 5, 2];array2d=([1, 2], [2, 1]);list1d=(1, "mixed!", 5, 2);list2d=(1, (1, 1.2, "foo"), ("bar", 1.2, 1));nasty_string="\"@
|
||||
\\ ^*bf
|
||||
0\";'''$";nested={attrset={has={a={integer={value=100;};};};};};simple_top_level_attr="1.0";some_floaty=29.95;weirderTypes={
|
||||
0\";'''$";nested={attrset={has={a={integer={value=100;};};};};level-dash="pass";};simple_top_level_attr="1.0";some_floaty=29.95;top-level-dash="pass";weirderTypes={
|
||||
@include "@include_file@"
|
||||
array_of_ints=[0732, 0xa3, 1234];bigint=9223372036854775807;float=0.0012;hex=0x1fc3;list_of_weird_types=(3.141592654, 9223372036854775807, 0x1fc3, 027, 1.2e-32, 1.0);octal=027;pi=3.141592654;};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user