capicue / pgn

A chess file parser for ruby
MIT License
47 stars 23 forks source link

PGN annotations #3

Closed tobiasvl closed 8 years ago

tobiasvl commented 10 years ago

I've added some rudimentary annotation support. I added non-standard (but widely used) "human" annotation glyphs, and re-added the numeric ones. I've also added support for variations, although they don't nest. I don't think that's possible to support when using a LALR(1) parser? Brace comments have also been added, but not semicolon comments because your parser skips whitespace.

schoblaska commented 10 years ago

+1, please merge.

Thanks for these changes, @tobiasvl! I'm using your branch in my project until this gets merged.

tobiasvl commented 10 years ago

@joeyschoblaska: No problem at all, pretty minor stuff.

However, I think my initial knee-jerk conclusion that nested variations were impossible were unfounded (it's been a while since I took computational linguistics classes) but I haven't had the time to implement it yet.

atduskgreg commented 10 years ago

I have just tried to switch over to this fork due to my problem as described in #4. I installed the fork via its git URL and Bundler and I'm getting a weird error:

pgn_fork_test.rb:4:in `<main>': undefined method `parse' for PGN:Module (NoMethodError)

You can see the (trivial hello world) example I've setup here (including Gemfile and Gemfile.lock): https://gist.github.com/atduskgreg/0acd0c006774b5afe310

If I simply change the require to "require 'pgn'" it works fine.

Am I missing something?

atduskgreg commented 10 years ago

Ok. I figured out what I was missing. I wasn't actually requiring pgn. D'Oh. Stupid mistake. My apologies. However, when I do require it I still end up with the same Whittle::UnconsumedInputError parsing error. I've corrected my gist and added the pgn file that causes the bug to my gist above. @tobiasvl it seems like there's still a problem parsing comments?

atduskgreg commented 10 years ago

And I finally figured it out. Since you and @gauleng made your changes in the pgn-annotations branch I had to tell bundler specifically to require that branch. Sorry for the repeated comments, but hopefully this helps someone else. I've updated my gist so that it does the right thing: https://gist.github.com/atduskgreg/0acd0c006774b5afe310

and can simply be run with

bundle exec ruby pgn_fork_test.rb path/to/file.pgn
capicue commented 8 years ago

Thanks so much for fixing this!

Sorry to have ignored it for so long. I'll release a new version later today.