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

Bug: PGNs without headers can not be parsed #12

Open
Epigene opened this issue Nov 12, 2017 · 2 comments
Open

Bug: PGNs without headers can not be parsed #12

Epigene opened this issue Nov 12, 2017 · 2 comments

Comments

@Epigene
Copy link

Epigene commented Nov 12, 2017

Hi!

The gem (v0.2.0) seems unable to parse PGNs without headers, which seem optional.

Does not parse:

1. e4 a6 2. Bc4 a5 3. Ne2 a4 4. O-O Ra7
5. e5 f5 6. exf6 a5 0-1

Error:

Whittle::ParseError: Parse error: expected one of :$end, "[" but got :move_number_indication on line 1.

1. e4 a6 2. Bc4 a5 3. Ne2 a4 4. O-O Ra7
^ ... occurred here

Parses:

[Event "Live Chess"]

1. e4 a6 2. Bc4 a5 3. Ne2 a4 4. O-O Ra7
5. e5 f5 6. exf6 a5 0-1
@tobiasvl
Copy link
Contributor

Well, the Seven Tag Roster tags aren't actually optional, although parsers should in general choose to be lax about stuff like that. See Wikipedia.

However, I agree that this gem seems to take a weird middle ground. Either it should require all seven STR tags, or not have any tag requirements at all. It seems strange that it needs the "Event" tag, of all tags (although I guess it just needs any arbitrary tag to be present).

@tobiasvl
Copy link
Contributor

tobiasvl commented Nov 12, 2017

Scratch that. From section 8.1 of the PGN specification

The tag pair section is composed of a series of zero or more tag pairs.

So for the "import format" it's explicitly noted that the tags are optional, so this seems like a bug.

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

No branches or pull requests

2 participants