fix: Serializing dictionary with ', ", . in key & #37
Fixes issue where GetTopLevelAndSubKeys splits a key when serializing. Adds test to handle new cases. Does not test cases with mixed " and ' due to issue explained in #37.
coverage: 92.835% (+0.9%) from 91.909% when pulling 9061871a70b934fc3b425100ad899da92af6c48b on ITR13:master into acbaa752568dc1557c90834cf538e9dc1e0025c6 on SamboyCoding:master.
Easiest way to understand the issue is the test StringTests.EscapedQuotesInAKeyAreValid:
The key string used there is "\"a.b\"", which when passed into StringTests.EscapedQuotesInAKeyAreValid would correctly only create a single key
The problem is that the parser pre-unescapes the key to "a.b", which breaks the whole thing. It might be possible to have it not unescape it, and instead unescape it later, but I don't know it this breaks other code.
The parser is also unable to parse strings in the form "a.b".c or ""a.b"".c, which both are allowed in the toml specification. For that I can imagine two possible fixes, but I haven't looked at the parser yet and would not know of any other issues:
- Make sure it doesn't look only for full quoted keys, then send the whole string back unmodified
- Add proper splitting & escaping at parser-level, then remove GetTopLevelAndSubKeys completely and instead have keys be handled as some sort of list of strings passed into ContainsKey and GetValue. I haven't worked enough with text processing to know the performance or memory usage impacts of either solution though.
This fix seems to be related to the issue I reported. Is there any ETA for it?