From f1a5c0a1350ae23d2ef2b46f8d47b51c92682d55 Mon Sep 17 00:00:00 2001 From: Chris Foster Date: Sun, 28 Jan 2024 21:41:29 -0500 Subject: [PATCH 1/2] Don't die when parsing informational marks on the end of move strings. --- src/position/mv.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/position/mv.rs b/src/position/mv.rs index fd436de7..0f0a4591 100644 --- a/src/position/mv.rs +++ b/src/position/mv.rs @@ -30,6 +30,8 @@ impl Move { } pub fn from_string(input: &str) -> Result { + // Trim informational marks + let input = input.trim_end_matches(['*', '?', '!', '\'']); if input.len() < 2 { return Err(pgn_traits::Error::new( pgn_traits::ErrorKind::ParseError, From 62597e1f75354be2b70a2d5f27560f93fc491d3c Mon Sep 17 00:00:00 2001 From: Chris Foster Date: Tue, 30 Jan 2024 16:56:17 -0500 Subject: [PATCH 2/2] Trim only crush notation instead of all informational marks. --- src/position/mv.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/position/mv.rs b/src/position/mv.rs index 0f0a4591..a8d7d3d9 100644 --- a/src/position/mv.rs +++ b/src/position/mv.rs @@ -30,8 +30,8 @@ impl Move { } pub fn from_string(input: &str) -> Result { - // Trim informational marks - let input = input.trim_end_matches(['*', '?', '!', '\'']); + // Trim crush notation + let input = input.trim_end_matches('*'); if input.len() < 2 { return Err(pgn_traits::Error::new( pgn_traits::ErrorKind::ParseError,