3 ms·
The format could be very simple, but... allowing comments after values make it unnecessarily complex to parse. For example: value = "example # no that's n
by laurent123456 14y ago
The format could be very simple, but... allowing comments after values make it unnecessarily complex to parse. For example:
value = "example # no that's not a comment" # but here's one
If inline comments where not allowed we could just check the first and last character for a quote and we know we have a string, same for arrays (check for [ and ]). But with inline comments, we need to parse the whole string.
As far as I can see both the C# and Python parsers don't handle this kind of comment correctly at the moment, and probably many implementations will have troubles with that. They should just drop this option in my opinion.
- adamtj 14y agoThat's not hard to parse. Inline comments are nice. You'll be doing more reading of files that writing of parsers.
- aroberge 14y agoWAT?. Python can parse the above very nicely, thank you. >>> value = "example # no that's not a comment" # but here's one >>> value "example # no that's not a comment"
- laurent123456 14y agoAt the time I wrote that, the only Python parser was removing the comments by splitting the line on "#", which mean it wouldn't work with the example I mentioned. It seems there are now several other Python parsers, so some of them are probably getting it right.