From bebbc7982482a2271096ef53c778cd93a4bbff7a Mon Sep 17 00:00:00 2001
From: Loic Guegan <manzerbredes@mailbox.org>
Date: Thu, 24 Feb 2022 18:53:43 +0100
Subject: [PATCH] Debug node parsing

---
 src/PGN.cpp | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/PGN.cpp b/src/PGN.cpp
index 155c815..bfe58fe 100644
--- a/src/PGN.cpp
+++ b/src/PGN.cpp
@@ -21,7 +21,7 @@
 #define IS_EOF (pgn_content.IsEOF())
 #define IS_TOKEN(c)                                                            \
   (IS_DIGIT(c) || IS_ALPHA(c) || c == '{' || c == '}' || c == '(' ||           \
-   c == ')' || c == '[' || c == ']' || c == '$' || c == '"' || c=='*')
+   c == ')' || c == '[' || c == ']' || c == '$' || c == '"' || c == '*')
 #define EOF_CHECK(loc)                                                         \
   {                                                                            \
     if (IS_EOF)                                                                \
@@ -70,18 +70,9 @@ void PGN::ParseNextGame() {
     if (!IS_BLANK(c)) {
       if (c == '[') {
         loc = ParseNextTag(loc);
-      } else if (IS_DIGIT(c)) {
+      } else {
         LastGameEndLoc = ParseHalfMove(loc, moves);
         break;
-      } else if (c == '*') {
-        result = "*";
-        LastGameEndLoc = loc + 1;
-        break;
-      } else if (c == '{') {
-        loc = ParseComment(loc, moves);
-        continue; // No need loc++
-      } else if (c == '%' || c == ';') {
-        loc = GotoEOL(loc);
       }
     }
     loc++;
@@ -161,6 +152,13 @@ loctype PGN::ParseHalfMove(loctype loc, HalfMove *hm) {
     return (loc + 1);
   }
 
+  // Parse comment
+  if (c == '{') {
+    loc = ParseComment(loc, hm);
+    EOF_CHECK(loc);
+    c = pgn_content[loc];
+  }
+
   // Parse move number and check if end of game
   if (IS_DIGIT(c)) {
     std::string move_nb;