lichess-org/dartchess

Bug in PGN parser

Closed this issue · 1 comments

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()}');
}

The cause of the bug is {?

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