aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-02-24 18:53:43 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-02-24 18:53:43 +0100
commitbebbc7982482a2271096ef53c778cd93a4bbff7a (patch)
tree660aebd7f33611b5d21c94c37aa0e2f10533932f
parent5d1796920e7c20e8f99f106935e10b8ec9296aba (diff)
Debug node parsing
-rw-r--r--src/PGN.cpp20
1 files 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;