mirror of
https://github.com/lichess-org/dartchess.git
synced 2026-05-26 13:51:01 +00:00
Revert "Add flag to indicate whether single game or multi game pgn is being parsed, handle linebreaks accordingly"
This reverts commit db66704b0e.
This commit is contained in:
+4
-9
@@ -103,7 +103,7 @@ class PgnGame<T extends PgnNodeData> {
|
||||
final List<PgnGame<PgnNodeData>> games = [];
|
||||
_PgnParser((PgnGame<PgnNodeData> game) {
|
||||
games.add(game);
|
||||
}, initHeaders, true)
|
||||
}, initHeaders)
|
||||
.parse(pgn);
|
||||
|
||||
if (games.isEmpty) {
|
||||
@@ -126,7 +126,7 @@ class PgnGame<T extends PgnNodeData> {
|
||||
final List<PgnGame<PgnNodeData>> games = [];
|
||||
_PgnParser((PgnGame<PgnNodeData> game) {
|
||||
games.add(game);
|
||||
}, initHeaders, false)
|
||||
}, initHeaders)
|
||||
.parse(pgn);
|
||||
return games;
|
||||
}
|
||||
@@ -678,10 +678,7 @@ class _PgnParser {
|
||||
/// Function to create the headers
|
||||
final PgnHeaders Function() initHeaders;
|
||||
|
||||
/// If true, pgn string is parsed for a single game. If false, pgn string is considered to have multiple games and any linebreak is considered as start of a new game
|
||||
final bool singleGame;
|
||||
|
||||
_PgnParser(this.emitGame, this.initHeaders, this.singleGame) {
|
||||
_PgnParser(this.emitGame, this.initHeaders) {
|
||||
_resetGame();
|
||||
_state = _ParserState.bom;
|
||||
}
|
||||
@@ -779,9 +776,7 @@ class _PgnParser {
|
||||
{
|
||||
if (freshLine) {
|
||||
if (_isCommentLine(line)) return;
|
||||
if (!singleGame) {
|
||||
if (_isWhitespace(line)) return _emit();
|
||||
}
|
||||
if (_isWhitespace(line)) return _emit();
|
||||
}
|
||||
final tokenRegex = RegExp(
|
||||
r'(?:[NBKRQ]?[a-h]?[1-8]?[-x]?[a-h][1-8](?:=?[nbrqkNBRQK])?|[pnbrqkPNBRQK]?@[a-h][1-8]|O-O-O|0-0-0|O-O|0-0)[+#]?|--|Z0|0000|@@@@|{|;|\$\d{1,4}|[?!]{1,2}|\(|\)|\*|1-0|0-1|1\/2-1\/2/');
|
||||
|
||||
Reference in New Issue
Block a user