aboutsummaryrefslogtreecommitdiff
path: root/src/PGN.cpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-01-15 08:26:49 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2023-01-15 08:26:49 +0100
commit52c2fd4521d33616514dc2a43ad1ee432ce16275 (patch)
treeb8a59aeab25285a4547d393e58675981cc212960 /src/PGN.cpp
parentef75681956ae842cbf1b2b357374aa34e3361448 (diff)
Debug PGN parsing from a string. Add the ParseSANMoves() function. Add a new tests set
Diffstat (limited to 'src/PGN.cpp')
-rw-r--r--src/PGN.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/PGN.cpp b/src/PGN.cpp
index 96346e8..c0c80e3 100644
--- a/src/PGN.cpp
+++ b/src/PGN.cpp
@@ -410,4 +410,13 @@ loctype PGN::GotoEOL(loctype loc) {
}
}
+void ParseSANMoves(const std::string &sequence,HalfMove *moves) {
+ PGN parser;
+ // Note that PGN need a results (* at the end)
+ // Otherwise an InvalidGameResult exception is raised
+ parser.FromString(sequence+" *");
+ parser.ParseNextGame();
+ parser.GetMoves(moves);
+}
+
} // namespace pgnp \ No newline at end of file