lichess-org / dartchess

Dart chess library for native platforms
https://pub.dev/packages/dartchess
GNU General Public License v3.0
35 stars 18 forks source link

Bug in PGN parser #38

Closed kuruhuru closed 3 weeks ago

kuruhuru commented 7 months ago

Hello! I found a problem when loading pgn with '{\nsome comments' pattern. May be even inside '(' variation I added example modified file wcc_2023_1.pgn wcc_2023_1.txt

I modified it here... image

And when I run the following code the application hangs

void main(List<String> args) {
  final String data = File('bin/pgn/wcc_2023_1.pgn').readAsStringSync();
  final List<PgnGame<PgnNodeData>> games = PgnGame.parseMultiGamePgn(data);
  print('Games: ${games.length}');
  print('Game 1: ${games[0].makePgn()}');
}
veloce commented 7 months ago

The cause of the bug is {?

Feel free to make a PR with a fix and and new test case. Thanks!