-
Notifications
You must be signed in to change notification settings - Fork 107
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
Possible implementation of limited comments #101
base: develop
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #101 +/- ##
========================================
Coverage 49.89% 49.89%
========================================
Files 23 23
Lines 1385 1387 +2
Branches 707 709 +2
========================================
+ Hits 691 692 +1
Misses 111 111
- Partials 583 584 +1
Continue to review full report at Codecov.
|
I got an email mentioning that it might be possible to use If somebody else wants to try adding some more options to this for maintainers to choose from in case they have concerns, using escape characters is another option. There might have also been a concern around the interface for enabling or disabling it. |
Hi, yes, sorry about that, that was my fault. As I have written previously, I believe the proposed technique calls for error-prone config files as I am not aware of any interpreter that behaves like this. If you also consider escape character instead (e.g. similarly to #!/usr/bin/env python3
import re
cases = [
(r"key=abcd", (r"key", r"abcd", r"")),
(r" key = abcd # com", (r" key ", r" abcd ", r" com")),
(r" key =abcd#comment", (r" key ", r"abcd", r"comment")),
(r"key =abcd #comment", (r"key ", r"abcd ", r"comment")),
(r" key=abcd\#nocomment", (r" key", r"abcd\#nocomment", r"")),
(r" key = abcd\#nocomment#com", (r" key ", r" abcd\#nocomment", r"com")),
(r" key = abcd\#nocomment###", (r" key ", r" abcd\#nocomment", r"##")),
(r" key = abcd\\#comment", (r" key ", r" abcd\\", r"comment")),
(r" key = abcd\\\#nocomment", (r" key ", r" abcd\\\#nocomment", r"")),
(r" key = abcd\nocomment", (r" key ", r" abcd\nocomment", r"")),
]
rex=r"([^=]+)=((?:\\.|[^\\#])*)#{0,1}(.*)"
for s, v in cases:
assert re.fullmatch(rex, s).groups() == v
print("OK") That could also be the default and only behavior so you would not need to pass an extra argument.
|
Thanks so much for your feedback. I'm worried adding it as the default behavior could break existing programs when distributions and developers upgrade. There are a lot of users of programs linked to boost out there, a huge config file space. Do you think there'd be a solution that preserves the behavior for people who happen to have the edge case of Developers wouldn't usually be able to predict if their users were affected by this change, to know whether to require an earlier version or not when upgrading, and it's a small change that would be hard to get everyone to spread preparation for. |
You have a good point. However, in my opinion, the edge case If it bothers you anyway, the next version of I guess @vprus will have to share his opinion with us. 🙂 |
I like the warning solution, although I'm thinking of GUI applications where the config files could even be autogenerated. I won't likely be working further on this PR for quite some time, so it's mostly just for when the work hours are available from someone. It seems to me a separate options class, or a separate member function to set the parsing options, might be a more robust solution. |
Provides for
#
characters in configuration file values. See #100