Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iniconf: Allow dot and dash for ini keys #4052

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ handler_hand01 input.conf /^[handler_hand01]$/;" section language:Iniconf
handlers input.conf /^[handlers]$/;" section language:Iniconf
handlers input.conf /^handlers=hand01$/;" key language:Iniconf section:logger_parser
handlers input.conf /^handlers=hand01$/;" key language:Iniconf section:logger_root
key-with-dashes input.conf /^key-with-dashes=value2$/;" key language:Iniconf section:section.with.dots
key.with.dots input.conf /^key.with.dots=value1$/;" key language:Iniconf section:section.with.dots
keys input.conf /^keys=form01$/;" key language:Iniconf section:formatters
keys input.conf /^keys=hand01$/;" key language:Iniconf section:handlers
keys input.conf /^keys=root,parser$/;" key language:Iniconf section:loggers
Expand All @@ -24,3 +26,4 @@ parser input.conf /^[logger_parser]$/;" loggerSection language:PythonLoggingConf
propagate input.conf /^propagate=1$/;" key language:Iniconf section:logger_parser
qualname input.conf /^qualname=compiler.parser$/;" key language:Iniconf section:logger_parser
root input.conf /^[logger_root]$/;" loggerSection language:PythonLoggingConfig
section.with.dots input.conf /^[section.with.dots]$/;" section language:Iniconf
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ args=(sys.stdout,)
format=F1 %(asctime)s %(levelname)s %(message)s
datefmt=
class=logging.Formatter

[section.with.dots]
key.with.dots=value1
key-with-dashes=value2
2 changes: 1 addition & 1 deletion parsers/iniconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
static bool isIdentifier (int c)
{
/* allow whitespace within keys and sections */
return (bool)(isalnum (c) || isspace (c) || c == '_');
return (bool)(isalnum (c) || isspace (c) || c == '_' || c == '-' || c == '.');
}

static bool isValue (int c)
Expand Down
Loading