Skip to content

Commit f158eb8

Browse files
authored
Merge pull request #4052 from techee/iniconf_toml
iniconf: Allow dot and dash for ini keys
2 parents 36fce6a + f609eab commit f158eb8

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Units/parser-iniconf.r/simple-pythonLoggingConfig.d/expected.tags

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ handler_hand01 input.conf /^[handler_hand01]$/;" section language:Iniconf
1111
handlers input.conf /^[handlers]$/;" section language:Iniconf
1212
handlers input.conf /^handlers=hand01$/;" key language:Iniconf section:logger_parser
1313
handlers input.conf /^handlers=hand01$/;" key language:Iniconf section:logger_root
14+
key-with-dashes input.conf /^key-with-dashes=value2$/;" key language:Iniconf section:section.with.dots
15+
key.with.dots input.conf /^key.with.dots=value1$/;" key language:Iniconf section:section.with.dots
1416
keys input.conf /^keys=form01$/;" key language:Iniconf section:formatters
1517
keys input.conf /^keys=hand01$/;" key language:Iniconf section:handlers
1618
keys input.conf /^keys=root,parser$/;" key language:Iniconf section:loggers
@@ -24,3 +26,4 @@ parser input.conf /^[logger_parser]$/;" loggerSection language:PythonLoggingConf
2426
propagate input.conf /^propagate=1$/;" key language:Iniconf section:logger_parser
2527
qualname input.conf /^qualname=compiler.parser$/;" key language:Iniconf section:logger_parser
2628
root input.conf /^[logger_root]$/;" loggerSection language:PythonLoggingConfig
29+
section.with.dots input.conf /^[section.with.dots]$/;" section language:Iniconf

Units/parser-iniconf.r/simple-pythonLoggingConfig.d/input.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ args=(sys.stdout,)
3131
format=F1 %(asctime)s %(levelname)s %(message)s
3232
datefmt=
3333
class=logging.Formatter
34+
35+
[section.with.dots]
36+
key.with.dots=value1
37+
key-with-dashes=value2

parsers/iniconf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
static bool isIdentifier (int c)
3636
{
3737
/* allow whitespace within keys and sections */
38-
return (bool)(isalnum (c) || isspace (c) || c == '_');
38+
return (bool)(isalnum (c) || isspace (c) || c == '_' || c == '-' || c == '.');
3939
}
4040

4141
static bool isValue (int c)

0 commit comments

Comments
 (0)