Either I’m not understanding something or there’s an inconsistency/bug in the SGF Parsing canonical data.
Line 323 has (roughly):
"description": "escaped t and n in property value are just letters, not whitespace",
"encoded": "(;A[\\t = t and \\n = n])",
"expected": "A": ["t = t and n = n"]
Line 370 has (roughly):
"description": "escaped property",
"encoded": "(;A[\\]b\\nc\\nd\\t\\te \\n\\]])",
"expected": "A": ["]b\\nc\\nd e \\n]"]
Unless I’m missing something, these two tests treat the same inputs differently.
I think the latter test case means to have an additional \ in there, such that there is a \\\\ which becomes \\ in the output, followed by an unescaped n but I’m not sure. This test was introduced in the original commit for this file (by cmccandless) and hasn’t changed since.
The problem description says,
\is the escape character. Any non-whitespace character after\is inserted as-is. Any whitespace character after\follows the above rules. Note that SGF does not have escape sequences for whitespace characters such as\tor\n.
I believe this supports the former test and my suspicion that the latter test has a bug.