Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading of NAGs with symbol characters and comments in between #120

Closed
tilvan opened this issue Aug 10, 2019 · 2 comments
Closed

Reading of NAGs with symbol characters and comments in between #120

tilvan opened this issue Aug 10, 2019 · 2 comments
Assignees
Labels

Comments

@tilvan
Copy link

tilvan commented Aug 10, 2019

Hi @mliebelt!
I'm new with PGN and I have an issue with PGN parser with pgn.js.
I have PGN fragment 1.Bxc4 d5 2.Bxd5 Qxd5 3.a5 {!} $16 - and here I have parser exception with message from pgnvjs.js

Expected " ", "(", ")", "*", "0-1", "0:1", "1-0", "1/2-1/2", "1:0", "O-O", "O-O-O", "x", "{", [RNBQKP], [a-h], or integer but "$" found.

How can I fix it with current configuration?

@mliebelt
Copy link
Owner

mliebelt commented Aug 17, 2019

The reason for that is, that the PgnViewerJS currently does not accept comments at any point. Here are the options that will work (I have added some words to the comment to make sure that everyone understands that this is the comment, it will of course work without):

  • Before the move number: {! this is a comment } 1.e4 $16
  • After the move number: 1. {! this is a comment } e4 $16
  • After the complete move: 1. e4 $16 {! this is a comment } (including the NAGs)

You can check that yourself with the configuration builder: https://mliebelt.github.io/PgnViewerJS/docu/example/config.html

I will check the grammar if it is easy to add comments between move and NAGs, but this may be endless. Something like 1. e4 ! { good move} ? { but I don't like it } would be a nightmare to parse.

The easiest fix for you is to change the PGN itself, so that the comments are coming after the NAGs.

Btw, comments are allowed anywhere outside so called tokens. See the PGN specification for details. This ticket is related to #97.

@mliebelt mliebelt self-assigned this Aug 17, 2019
@mliebelt mliebelt added the bug label Aug 17, 2019
@mliebelt mliebelt changed the title Reading of NAGs with symbol characters Reading of NAGs with symbol characters and comments in between Jun 17, 2020
@mliebelt
Copy link
Owner

Well, after changing the grammar again and again, I am pretty sure that I will never ever implement that feature. Not only the reading will be a nightmare, but also the print-out. So i will close that ticket without a fix. Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants