Skip to content

Commit 285d2e6

Browse files
authored
clarify sgf instructions (#1887)
* fix sgf canonical-data * clarify whitespace * consistent terminology * improve content * typo * pr comments * typo
1 parent 1ee646b commit 285d2e6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

exercises/sgf-parsing/description.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ A key can have multiple values associated with it. For example:
5353

5454
Here `AB` (add black) is used to add three black stones to the board.
5555

56+
According the the SGF specification `\` is the escape character. When `\` is
57+
encountered during parsing, it indicates that the following character should be
58+
printed as is. The exception to this is whitespace, with newline, carriage
59+
return and tab encoded as `"\n"`, `"\r"` and `"\t"` respectively. When parsing
60+
you can expect some characters to _always_ be escaped, including parentheses,
61+
square brackets, semicolons and colons.
62+
63+
When parsing SGF files whitespace gets special handling, with the exception of
64+
newlines any whitespace character encountered is replaced with a single space
65+
character irrespective of if the original character is found in its escaped
66+
from or its unescaped from.
67+
5668
There are a few more complexities to SGF (and parsing in general), which
5769
you can mostly ignore. You should assume that the input is encoded in
5870
UTF-8, the tests won't contain a charset property, so don't worry about

0 commit comments

Comments
 (0)