On Thu, Jul 12, 2012 at 2:05 PM, Daniel Shahaf <d.s_at_daniel.shahaf.name> wrote:
> Johan Corveleyn wrote on Thu, Jul 12, 2012 at 11:28:18 +0200:
>> I think the only character that causes problems is ']' (which ends the
>> section name parsing). It seems not too hard to change that parsing
>
> Technically, 0x0A (newline) would likely be a problem too. Not sure
> that anyone uses it...
>
>> function to make it handle some kind of escape sequence for ']'
>
> What escape syntax does http://docs.python.org/library/configparser use?
I think it uses none.
I've just checked the source of ConfigParser.py in my Python 2.7
distribution, which contains this:
[[[
SECTCRE = re.compile(
r'\[' # [
r'(?P<header>[^]]+)' # very permissive!
r'\]' # ]
)
]]]
This regex is matched against lines, and the group named "header" is
taken as section name. So this seems to be effectively the same as our
parsing routine: after the '[', we take all non-']' until we encounter
']'.
On Thu, Jul 12, 2012 at 2:06 PM, Daniel Shahaf <d.s_at_daniel.shahaf.name> wrote:
> Johan Corveleyn wrote on Thu, Jul 12, 2012 at 12:06:07 +0200:
>> I think ']]' would be the best choice, but still not 100% backwards
>> compatible. But I mean, who in their right mind would write sections
>> like this:
>>
>> [repo:/path/to/file.ext]]haha, this isn't parsed
>
> We document the format as "ini format" and more specifically "same as
> Python's ConfigParser", and the above isn't valid in either of those, so
> we needn't provide back compat for it.
Where is this documented?
Besides: for Python's ConfigParser (if I understand the code
correctly) I think the above is valid in the way that it doesn't
generate errors: everything after the first ']' is simply ignored.
--
Johan
Received on 2012-07-12 16:46:30 CEST