lichess-org / scalachess

Chess API written in scala. Immutable and free of side effects.

Home Page:https://lichess.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PGN cleanup may break comments

niklasf opened this issue · comments

It looks like these global replacements are intended to gracefully deal with invalid PGNs enclosed in [pgn]...[/pgn], using non-ASCII dashes in O-O and O-O-O, and en passant captures like exd6 e.p.. But they would also incorrectly modify comments.

https://github.com/ornicar/scalachess/blob/6e6062fd3f9ddba870051ceaf9e47b87733a7d2d/src/main/scala/format/pgn/Parser.scala#L24-L28

I was wondering about this part as well. With the current implementation we don't really need this step.

Removing this step also helps us show the error location correctly. Now we can only show the location of the error in the pre-processed string, not for the whole original string.

I can work on this issue.