From 593d9eaca413b78b5e2cc5eb2bc2fdafca827239 Mon Sep 17 00:00:00 2001 From: Hiraoka Date: Thu, 16 Jul 2020 20:51:39 +0900 Subject: [PATCH] support ";)" in old SGF --- katrain/core/sgf_parser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/katrain/core/sgf_parser.py b/katrain/core/sgf_parser.py index 46940ba..fd3ca01 100644 --- a/katrain/core/sgf_parser.py +++ b/katrain/core/sgf_parser.py @@ -380,7 +380,10 @@ class SGF: if matched_item == "(": self._parse_branch(self._NODE_CLASS(parent=current_move)) elif matched_item == ";": - if not current_move.empty: # ignore ; that generate empty nodes + # ignore ;) for old SGF + useless = self.ix < len(self.contents) and self.contents[self.ix] == ")" + # ignore ; that generate empty nodes + if not (current_move.empty or useless): current_move = self._NODE_CLASS(parent=current_move) else: property, value = match[1], match[2].strip()[1:-1]